10000 minor #8549 Add default_path option reference (yceruto, javiereguiluz) · symfony/symfony-docs@7d5e794 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7d5e794

Browse files
committed
minor #8549 Add default_path option reference (yceruto, javiereguiluz)
This PR was merged into the 3.4 branch. Discussion ---------- Add default_path option reference symfony/symfony#24179 Commits ------- 66fd357 Minor tweaks af245fc Add default_path option reference
2 parents f8ddf1f + 66fd357 commit 7d5e794

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

reference/configuration/twig.rst

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ TwigBundle Configuration ("twig")
5454
strict_variables: ~
5555
auto_reload: ~
5656
optimizations: ~
57+
default_path: '%kernel.project_dir%/templates'
5758
paths:
5859
'%kernel.project_dir%/vendor/acme/foo-bar/templates': foo_bar
5960
@@ -87,6 +88,7 @@ TwigBundle Configuration ("twig")
8788
debug="%kernel.debug%"
8889
strict-variables="false"
8990
optimizations="true"
91+
default-path="%kernel.project_dir%/templates"
9092
>
9193
<twig:form-theme>form_div_layout.html.twig</twig:form-theme> <!-- Default -->
9294
<twig:form-theme>form.html.twig</twig:form-theme>
@@ -136,6 +138,7 @@ TwigBundle Configuration ("twig")
136138
'decimal_point' => ',',
137139
'thousands_separator' => '.',
138140
),
141+
'default_path' => '%kernel.project_dir%/templates',
139142
));
140143
141144
.. caution::
@@ -338,6 +341,16 @@ on. Set it to ``0`` to disable all the optimizations. You can even enable or
338341
disable these optimizations selectively, as explained in the Twig documentation
339342
about `the optimizer extension`_.
340343

344+
default_path
345+
~~~~~~~~~~~~
346+
347+
**type**: ``string`` **default**: ``'%kernel.project_dir%/templates'``
348+
349+
.. BC1C versionadded:: 3.4
350+
The ``default_path`` option was introduced in Symfony 3.4.
351+
352+
The default directory where Symfony will look for Twig templates.
353+
341354
.. _config-twig-paths:
342355

343356
paths
@@ -346,9 +359,13 @@ paths
346359
**type**: ``array`` **default**: ``null``
347360

348361
This option defines the directories where Symfony will look for Twig templates
349-
in addition to the default locations (``app/Resources/views/`` and the bundles'
350-
``Resources/views/`` directories). This is useful to integrate the templates
351-
included in some library or package used by your application.
362+
in addition to the default locations. Symfony looks for the templates in the
363+
following order:
364+
365+
1. The directories defined in this option;
366+
2. The ``Resources/views/`` directories of the bundles used in the application;
367+
3. The ``src/Resources/views/`` directory of the application;
368+
4. The directory defined in the ``default_path`` option.
352369

353370
The values of the ``paths`` option are defined as ``key: value`` pairs where the
354371
``value`` part can be ``null``. For example:

0 commit comments

Comments
 (0)
0