8000 feature #14135 Replace overriding twig.paths by twig.default_path (l-vo) · symfony/symfony-docs@29e448a · GitHub
[go: up one dir, main page]

Skip to content

Commit 29e448a

Browse files
committed
feature #14135 Replace overriding twig.paths by twig.default_path (l-vo)
This PR was merged into the 3.4 branch. Discussion ---------- Replace overriding twig.paths by twig.default_path Since `twig.default_path` has been introduced (3.4), it should be a better idea to override it instead of `twig.paths` for customizing the directory structure (default path is added to paths anyway). Commits ------- c3b9b2b Replace overriding twig.paths by twig.default_path
2 parents 8d8b06c + c3b9b2b commit 29e448a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

configuration/override_dir_structure.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ Override the Templates Directory
9494
--------------------------------
9595

9696
If your templates are not stored in the default ``app/Resources/views/``
97-
directory, use the :ref:`twig.paths <config-twig-paths>` configuration option to
98-
define your own templates directory (or directories):
97+
directory, use the :ref:`twig.default_path <config-twig-default-path>` configuration option to
98+
define your own templates directory (use :ref:`twig.paths <config-twig-paths>` for multiple directories):
9999

100100
.. configuration-block::
101101

@@ -104,7 +104,7 @@ define your own templates directory (or directories):
104104
# app/config/config.yml
105105
twig:
106106
# ...
107-
paths: ["%kernel.project_dir%/templates"]
107+
default_path: "%kernel.project_dir%/templates"
108108
109109
.. code-block:: xml
110110
@@ -119,7 +119,7 @@ define your own templates directory (or directories):
119119
https://symfony.com/schema/dic/twig/twig-1.0.xsd">
120120
121121
<twig:config>
122-
<twig:path>%kernel.project_dir%/templates</twig:path>
122+
<twig:default-path>%kernel.project_dir%/templates</twig:default-path>
123123
</twig:config>
124124
125125
</container>
@@ -128,9 +128,7 @@ define your own templates directory (or directories):
128128
129129
// app/config/config.php
130130
$container->loadFromExtension('twig', [
131-
'paths' => [
132-
'%kernel.project_dir%/templates',
133-
],
131+
'default_path' => '%kernel.project_dir%/templates',
134132
]);
135133
136134
.. _override-web-dir:

reference/configuration/twig.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ on. Set it to ``0`` to disable all the optimizations. You can even enable or
243243
disable these optimizations selectively, as explained in the Twig documentation
244244
about `the optimizer e 600D xtension`_.
245245

246+
.. _config-twig-default-path:
247+
246248
``default_path``
247249
~~~~~~~~~~~~~~~~
248250

0 commit comments

Comments
 (0)
0