私は単純な問題があります。 私はちょうどので、symfonyにチェックボックスウィジェットを作成したい:symfonyでラベルをカスタマイズしてチェックボックスを作成する
$builder->add("terms", CheckboxType::class, array('label'=>false));
をしかし、私はこの出力を得る:
<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>
私はラベルのテキストを変更したいが、PHPでラベルattributをオーバーライドするときに出力されます:
<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>
私は2つのラベルを持っています。
私が取得したいでしょう:
私はこの bundle(BraincraftedBootstrapBundle)を使用<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>
あなたの助けをいただき、ありがとうございます。
<div class="checkbox">
<label for="fos_user_registration_form_terms" class="required">
{{form_widget(form.terms)}}
My label for accept terms with
<a> tag </a>
</label>
</div>
ただ、フォームウィジェットをレンダリングし、手でラベルを作成します。
フォームテンプレートhttp://symfony.com/doc/current/cookbook/form/form_customization.html –
@dragosteを変更する必要があります。 :D –
http://symfony.com/doc/current/cookbook/form/form_customization.html – pavlovich