@@ -54,6 +54,7 @@ TwigBundle Configuration ("twig")
54
54
strict_variables : ~
55
55
auto_reload : ~
56
56
optimizations : ~
57
+ default_path : ' %kernel.project_dir%/templates'
57
58
paths :
58
59
' %kernel.project_dir%/vendor/acme/foo-bar/templates ' : foo_bar
59
60
@@ -87,6 +88,7 @@ TwigBundle Configuration ("twig")
87
88
debug =" %kernel.debug%"
88
89
strict-variables =" false"
89
90
optimizations =" true"
91
+ default-path =" %kernel.project_dir%/templates"
90
92
>
91
93
<twig : form-theme >form_div_layout.html.twig</twig : form-theme > <!-- Default -->
92
94
<twig : form-theme >form.html.twig</twig : form-theme >
@@ -136,6 +138,7 @@ TwigBundle Configuration ("twig")
136
138
'decimal_point' => ',',
137
139
'thousands_separator' => '.',
138
140
),
141
+ 'default_path' => '%kernel.project_dir%/templates',
139
142
));
140
143
141
144
.. caution ::
@@ -338,6 +341,16 @@ on. Set it to ``0`` to disable all the optimizations. You can even enable or
338
341
disable these optimizations selectively, as explained in the Twig documentation
339
342
about `the optimizer extension `_.
340
343
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
+
341
354
.. _config-twig-paths :
342
355
343
356
paths
@@ -346,9 +359,13 @@ paths
346
359
**type **: ``array `` **default **: ``null ``
347
360
348
361
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.
352
369
353
370
The values of the ``paths `` option are defined as ``key: value `` pairs where the
354
371
``value `` part can be ``null ``. For example:
0 commit comments