Monday 15 February 2010

symfony - How to customize form_label block in form template in Symfony2? -


I am trying to customize form_label in a template that already provides a template.

Use example in I:

  {% use_form_label '}}} {form_label} with form_label as base_form_label%} {% block (' Base_form_label ')}} {% expected to use%} & lt; Span class = "required" heading = "this field is required" & gt; * & Lt; / Span & gt; {% Endif%} {% endblock%}   

But nothing changed!

Can you help me?

This is my solution.

At the top of my form.html.twig file:

  {'MyBundle: Activity: Form / fields. Html.wig '%}   

And now in fields.html.twig, I have the form_label custom:

  {% expanded' form_div_layout.html.twig ' %} {% Block form_label%} {% spaceless%} {% if not compound%} {% set label_attr = label_attr | Merge ({'for': 'id})%} {% endif%} {% if required%} {% set label_tr = label_it | Merge ({label_attr.class | default ('') ~ 'required') | trim}}%} {% Endif%} {% label is empty%} {% set label = name | standardization%} {{Attrename} for labels, label attribute =} in label, {{attrname}} = "{{attrvalue}} {{end_only}" & gt; ({{attr.note}}) Lt; / span & gt; {% endif%} & lt; / Labels & gt; {% Endpaceless%} {% endblock form_label%}    

No comments:

Post a Comment