From 8d45f8343f210b2e38449af6ba7d9dc5c1140e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Tue, 2 May 2017 13:14:22 +0200 Subject: [PATCH 1/2] Document disabling the usage of globally defined form themes --- form/form_customization.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/form/form_customization.rst b/form/form_customization.rst index 1ed087a32d6..9ce03d29b35 100644 --- a/form/form_customization.rst +++ b/form/form_customization.rst @@ -336,6 +336,37 @@ 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, form themes shipped with Symfony + (``form_div_layout.html.twig`` and others) will not be used, so to render your + forms correcly, you need to either provide the base form theme yourself, or + ``use`` one of the built in form themes from your own theme: + + .. code-block:: html+twig + + {# app/Resources/views/common.html.twig #} + {% use "form_div_layout.html.twig" %} + + {# ... #} + Child Forms ........... From 14ef7ae628f762433c17bafe8c7b94682a765669 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 29 Oct 2017 19:55:46 +0100 Subject: [PATCH 2/2] Minor reword --- form/form_customization.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/form/form_customization.rst b/form/form_customization.rst index 9ce03d29b35..ec92c3fd1ff 100644 --- a/form/form_customization.rst +++ b/form/form_customization.rst @@ -355,10 +355,11 @@ themes: .. caution:: - When using the ``only`` keyword, form themes shipped with Symfony - (``form_div_layout.html.twig`` and others) will not be used, so to render your - forms correcly, you need to either provide the base form theme yourself, or - ``use`` one of the built in form themes from your own theme: + 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 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy