Ich habe ein einfaches Problem. Ich will nur eine Checkbox-Widget mit symfony erstellen, so:Kontrollkästchen erstellen mit anpassen Label in Symfony
$builder->add("terms", CheckboxType::class, array('label'=>false));
Aber ich erhalten diese Ausgabe:
<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>
Ich möchte Text des Labels ändern, aber wenn das Label Ausprägungs in PHP überschreiben, ist der Ausgang :
<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>
Ich habe zwei Label.
Ich werde erhalten möchten:
<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>
Ich benutze diese bundle (BraincraftedBootstrapBundle)
Dank für Ihre Hilfe danken.
Sie müssen Formularvorlage ändern http://symfony.com/doc/current/cookbook/form/form_customization.html –
@dragoste Sie schlagen mich dazu! : D –
Auch http://symfony.com/doc/current/cookbook/form/form_customization.html – pavlovich