I have a simply problem. I want just to create a checkbox widget with symfony so:
$builder->add("terms", CheckboxType::class, array('label'=>false));
But i obtain this output:
<div class="checkbox">
<label for="fos_user_registration_form_terms" class="required">
<input id="fos_user_registration_form_terms" name="fos_user_registration_form[terms]" required="required" class=" checkbox" value="1" type="checkbox">
Terms
</label>
</div>
I want change text of label but when override the label attribut in PHP the output is:
<div class="checkbox">
<label for="fos_user_registration_form_terms" class="required">
<div class="checkbox">
<label for="fos_user_registration_form_terms" class="required required">
<input id="fos_user_registration_form_terms" name="fos_user_registration_form[terms]" required="required" class=" checkbox" value="1" type="checkbox">
test
</label>
</div>
test
</label>
</div>
I have two label.
I will want obtain:
<div class="checkbox">
<label for="fos_user_registration_form_terms" class="required">
<input id="fos_user_registration_form_terms" name="fos_user_registration_form[terms]" required="required" class=" checkbox" value="1" type="checkbox">
My label for accept terms with <a> tag
</label>
I use this bundle (BraincraftedBootstrapBundle)
Thank you for your help.
$builder->add("terms",Symfony defaults to use the quoted string in the add method; in your case "terms", and capitalizes the first letter. Question for you: Is the label you want to use in a file? Above you show with an <a> tag. Do you want to show a large amount of HTML text?