Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions form/form_customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,12 @@ 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, 'Your Name', {'label_attr': {'class': 'foo'}, 'label_raw': true}) }}

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

See ":ref:`twig-reference-form-variables`" to learn about the ``variables``
Expand Down Expand Up @@ -409,6 +410,7 @@ Variable Usage
``id`` The ``id`` HTML attribute to be rendered.
``label`` The string label that will be rendered.
``label_attr`` A key-value array that will be rendered as HTML attributes on the label.
``label_raw`` If ``true`` the twig raw filter will be used to render the label text.
``method`` The method of the current form (POST, GET, etc.).
``multipart`` If ``true``, ``form_enctype`` will render ``enctype="multipart/form-data"``.
``name`` The name of the field (e.g. ``title``) - but not the ``name``
Expand Down