Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Form] Document disabling the usage of globally defined form themes#8495

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 2 commits intosymfony:3.4fromemodric:form_theme_only
Nov 10, 2017
Merged
Changes fromall 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
32 changes: 32 additions & 0 deletionsform/form_customization.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -336,6 +336,38 @@ name of all the templates as an array using the ``with`` keyword:
The templates can also be located in different bundles, use the Twig namespaced
path to reference these templates, e.g. ``@AcmeFormExtra/form/fields.html.twig``.

Disabling usage of globally defined themes
..........................................

Sometimes it is useful to disable usage of globally defined form themes in order
to have more control over rendering of a form. You might want this, for example,
when creating admin interface for a bundle which can be installed on a wide range
of Symfony apps and you can't control what themes are defined globally.

You can do this by including the ``only`` keyword after the list of used form
themes:

.. code-block:: html+twig

{% form_theme form with ['common.html.twig', 'form/fields.html.twig'] only %}

{# ... #}

.. caution::

When using the ``only`` keyword, none of Symfony's built-in form themes
(``form_div_layout.html.twig``, etc.) will be applied. In order to render
your forms correctly, you need to either provide a full-featured form theme
yourself, or extend one of the built-in form themes with Twig's ``use``
keyword instead of ``extends`` to reuse the original theme contents.

.. code-block:: html+twig

{# app/Resources/views/common.html.twig #}
{% use "form_div_layout.html.twig" %}

{# ... #}

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

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp