Link in Symfony buildForm label -
in form symfony2, how can that:
->add('contract','checkbox',array( 'label' => 'link <a href="#">my link</a>', 'required' => true ))
with valid link, , not html formated ?..
thank help
you need utilize form customization feature. please check article more info -http://symfony.com/doc/current/cookbook/form/form_customization.html
by default label content escaped. don't valid html there.
example of overwrite:
form_theme.twig.html
{% block form_label %} {% spaceless %} <label {% attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ label| trans({}, translation_domain) | raw }}</label> {% endspaceless %} {% endblock form_label %}
template.twig.html
{% form_theme form 'mybundle:form:form_theme.html.twig' %} {{ form_row(form.contract) }}
symfony-2.3
No comments:
Post a Comment