Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3924

Overriding checkbox form field producing duplicate label and no field in Symfony 4.4

$
0
0

I am having trouble overriding a checkbox field in my Symfony form inside my Twig template.

I am building the field with the following code in my Twig template:

{{ form_row(form.legal, {'label' : 'personal.form.fields.legal'|trans,}) }}

In the same template I have the following block where I am attempting to customise the label. Note the translation above includes HTML which is why I need the raw filter.

{% block _crmpiccobundle_details_legal_label %}    {% apply spaceless %}<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>            {{ label|unescape|raw }}</label>    {% endapply %}{%- endblock %}

Unfortunately, this doesn't work and bizarrely leaves me with no checkbox and a duplicate label and I can't work out why.


Viewing all articles
Browse latest Browse all 3924

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>