Skip to content

Commit 4909e64

Browse files
committed
Add default_path option reference
1 parent c40186e commit 4909e64

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

reference/configuration/twig.rst

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ TwigBundle Configuration ("twig")
6565
decimal_point: ','
6666
thousands_separator: '.'
6767
68+
# The following was added in Symfony 3.4.
69+
default_path: '%kernel.project_dir%/templates'
70+
6871
.. code-block:: xml
6972
7073
<!-- app/config/config.xml -->
@@ -85,6 +88,7 @@ TwigBundle Configuration ("twig")
8588
debug="%kernel.debug%"
8689
strict-variables="false"
8790
optimizations="true"
91+
default-path="%kernel.project_dir%/templates"
8892
>
8993
<twig:form-theme>form_div_layout.html.twig</twig:form-theme> <!-- Default -->
9094
<twig:form-theme>form.html.twig</twig:form-theme>
@@ -134,6 +138,7 @@ TwigBundle Configuration ("twig")
134138
'decimal_point' => ',',
135139
'thousands_separator' => '.',
136140
),
141+
'default_path' => '%kernel.project_dir%/templates',
137142
));
138143
139144
.. caution::
@@ -336,6 +341,13 @@ on. Set it to ``0`` to disable all the optimizations. You can even enable or
336341
disable these optimizations selectively, as explained in the Twig documentation
337342
about `the optimizer extension`_.
338343

344+
default_path
345+
~~~~~~~~~~~~
346+
347+
**type**: ``string`` **default**: ``'%kernel.project_dir%/templates'``
348+
349+
The default directory where Symfony will look for Twig templates.
350+
339351
.. _config-twig-paths:
340352

341353
paths
@@ -344,9 +356,9 @@ paths
344356
**type**: ``array`` **default**: ``null``
345357

346358
This option defines the directories where Symfony will look for Twig templates
347-
in addition to the default locations (``app/Resources/views/`` and the bundles'
348-
``Resources/views/`` directories). This is useful to integrate the templates
349-
included in some library or package used by your application.
359+
in addition to the default locations (``src/Resources/views/``, ``templates/``
360+
and the bundles ``Resources/views/`` directories). This is useful to integrate
361+
the templates included in some library or package used by your application.
350362

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

0 commit comments

Comments
 (0)