@@ -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
338341disable these optimizations selectively, as explained in the Twig documentation
339342about `the optimizer extension `_.
340343
344+ default_path
345+ ~~~~~~~~~~~~
346+
347+ **type **: ``string `` **default **: ``'%kernel.project_dir%/templates' ``
348+
349+ .. 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
343356paths
@@ -346,9 +359,13 @@ paths
346359**type **: ``array `` **default **: ``null ``
347360
348361This 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
353370The values of the ``paths `` option are defined as ``key: value `` pairs where the
354371``value `` part can be ``null ``. For example:
0 commit comments