- Issue created by @2dareis2do
- 🇵🇪Peru hatuhay Lima
Just copy the templete to your subtheme and edit to your need.
- Status changed to Closed: works as designed
about 1 year ago 12:38pm 22 November 2023
I am pretty sure there is an issue with bootstrap barrio's implementation of checkboxes and radio buttons. I struggled with this for a while so thought I would share the solution.
Firstly, it should be possible to add a class to a label.
e.g.
// '#label_attributes' => ['class' => ['btn', 'btn-primary']],
However this does not seem to be possible with your implementation where you have the following in form-element.html.twig:
{% if label_display == 'after' %}
<label {{ label_attributes.addClass(labelclass).setAttribute('for', input_attributes.id) }}>
{{ input_title | raw }}
</label>
{% endif %}
My solution to this was to replace with the following:
{% if label_display == 'after' %}
{{ label }}
{% endif %}
This uses the label as defined in templates/form/form-element-label.html.twig e.g.
{% if title is not empty or required -%}
<label{{ attributes.addClass(classes) }}>{{ title }}</label>
{%- endif %}
This allows you to set classes etc on the labels.
Closed: works as designed
5.5
Code
Just copy the templete to your subtheme and edit to your need.