Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 583 Bytes

form_label.md

File metadata and controls

18 lines (13 loc) · 583 Bytes

form_label

form_label(orm_view, label, variables) is a Twig function to render the label for the given field. You can optionally pass the specific label you want to display as the second argument.

{{ form_label(form.name) }}

{# The two following syntaxes are equivalent #}
{{ form_label(form.name, 'Your Name', {'label_attr': {'class': 'foo'}}) }}

{{ form_label(form.name, null, {
    'label': 'Your name',
    'label_attr': {'class': 'foo'}
}) }}

Source: Forms