8000 Added a note about customizing a form with more than one template by javiereguiluz · Pull Request #3875 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Added a note about customizing a form with more than one template #3875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 11, 2014
Merged
Changes from 1 commit
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
Next Next commit
Added a note about customizing a form with more than one template
  • Loading branch information
javiereguiluz committed May 26, 2014
commit 2b0213b365f2f11e6c8db324f093280d5248512d
27 changes: 27 additions & 0 deletions cookbook/form/form_customization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,33 @@ When the ``form.age`` widget is rendered, Symfony will use the ``integer_widget`
block from the new template and the ``input`` tag will be wrapped in the
``div`` element specified in the customized block.

Multiple templates
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple Templates

..................

A form can also be customized applying several templates. To do so, pass the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... form can also be customized by applying several templates. To do this, pass

name of all the templates to the ``form_theme`` tag separat 7859 ing them with one
whitespace:

.. code-block:: html+jinja

{% form_theme form '::common.html.twig' ':Form:fields.html.twig'
'AcmeDemoBundle:Form:fields.html.twig' %}

{# ... #}

The templates can be located at different bundles and they can even be stored
at the global ``app/Resources/views/`` directory.

When using the ``with`` keyword, pass the templates as an array:


.. code-block:: html+jinja

{% form_theme form with ['::common.html.twig', ':Form:fields.html.twig',
'AcmeDemoBundle:Form:fields.html.twig'] %}

{# ... #}

Child Forms
...........

Expand Down
0