File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -336,6 +336,37 @@ name of all the templates as an array using the ``with`` keyword:
336336The templates can also be located in different bundles, use the Twig namespaced
337337path to reference these templates, e.g. ``@AcmeFormExtra/form/fields.html.twig ``.
338338
339+ Disabling usage of globally defined themes
340+ ..........................................
341+
342+ Sometimes it is useful to disable usage of globally defined form themes in order
343+ to have more control over rendering of a form. You might want this, for example,
344+ when creating admin interface for a bundle which can be installed on a wide range
345+ of Symfony apps and you can't control what themes are defined globally.
346+
347+ You can do this by including the ``only `` keyword after the list of used form
348+ themes:
349+
350+ .. code-block :: html+twig
351+
352+ {% form_theme form with ['common.html.twig', 'form/fields.html.twig'] only %}
353+
354+ {# ... #}
355+
356+ .. caution ::
357+
358+ When using the ``only `` keyword, form themes shipped with Symfony
359+ (``form_div_layout.html.twig `` and others) will not be used, so to render your
360+ forms correcly, you need to either provide the base form theme yourself, or
361+ ``use `` one of the built in form themes from your own theme:
362+
363+ .. code-block :: html+twig
364+
365+ {# app/Resources/views/common.html.twig #}
366+ {% use "form_div_layout.html.twig" %}
367+
368+ {# ... #}
369+
339370Child Forms
340371...........
341372
You can’t perform that action at this time.
0 commit comments