diff --git a/form/form_customization.rst b/form/form_customization.rst index 3551ed2344e..9db536dfbd6 100644 --- a/form/form_customization.rst +++ b/form/form_customization.rst @@ -87,6 +87,49 @@ control over how each form field is rendered, so you can fully customize them: Later in this article you can find the full reference of these Twig functions with more usage examples. +.. _reference-forms-twig-field-helpers: + +Form Field Helpers +------------------ + +The ``form_*()`` helpers render each part of the form field, including all its needed HTML elements. Most developers +like this behavior, but some designers struggle with it, because it hides all the HTML in form themes which are not +easy to manage by them. + +That's why some Twig form helpers are available to render the value of each form field part without adding any +HTML around it: + +* ``field_name`` +* ``field_value`` +* ``field_label`` +* ``field_help`` +* ``field_errors`` +* ``field_choices`` (an iterator of the field choices; e.g. for `` + + + +.. versionadded:: 5.2 + + The ``field_*()`` helpers were introduced in Symfony 5.2. + Form Rendering Variables ------------------------ diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 38d96910fd2..0ee70b0929d 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -365,6 +365,12 @@ explained in the article about :doc:`customizing form rendering ` * :ref:`form_row() ` * :ref:`form_rest() ` +* :ref:`field_name() ` +* :ref:`field_value() ` +* :ref:`field_label() ` +* :ref:`field_help() ` +* :ref:`field_errors() ` +* :ref:`field_choices() ` .. _reference-twig-filters: