@@ -67,6 +67,9 @@ TwigBundle Configuration ("twig")
67
67
decimal_point : ' ,'
68
68
thousands_separator : ' .'
69
69
70
+ # The following was added in Symfony 3.4.
71
+ default_path : ' %kernel.project_dir%/templates'
72
+
70
73
.. code-block :: xml
71
74
72
75
<!-- app/config/config.xml -->
@@ -87,6 +90,7 @@ TwigBundle Configuration ("twig")
87
90
debug =" %kernel.debug%"
88
91
strict-variables =" false"
89
92
optimizations =" true"
93
+ default-path =" %kernel.project_dir%/templates"
90
94
>
91
95
<twig : form-theme >form_div_layout.html.twig</twig : form-theme > <!-- Default -->
92
96
<twig : form-theme >form.html.twig</twig : form-theme >
@@ -136,6 +140,7 @@ TwigBundle Configuration ("twig")
136
140
'decimal_point' => ',',
137
141
'thousands_separator' => '.',
138
142
),
143
+ 'default_path' => '%kernel.project_dir%/templates',
139
144
));
140
145
141
146
.. caution ::
@@ -338,6 +343,13 @@ on. Set it to ``0`` to disable all the optimizations. You can even enable or
338
343
disable these optimizations selectively, as explained in the Twig documentation
339
344
about `the optimizer extension `_.
340
345
346
+ default_path
347
+ ~~~~~~~~~~~~
348
+
349
+ **type **: ``string `` **default **: ``'%kernel.project_dir%/templates' ``
350
+
351
+ The default directory where Symfony will look for Twig templates.
352
+
341
353
.. _config-twig-paths :
342
354
343
355
paths
@@ -346,9 +358,13 @@ paths
346
358
**type **: ``array `` **default **: ``null ``
347
359
348
360
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.
361
+ in addition to the default locations. Symfony looks for the templates in the
362
+ following order:
363
+
364
+ 1. The directories defined in this option;
365
+ 2. The ``src/Resources/views/ `` directory of the application;
366
+ 3. The directory defined in the ``default_path `` option;
367
+ 4. The ``Resources/views/ `` directories of the bundles used in the application.
352
368
353
369
The values of the ``paths `` option are defined as ``key: value `` pairs where the
354
370
``value `` part can be ``null ``. For example:
0 commit comments