Skip to content

Commit a0aec31

Browse files
silverbackdanjaviereguiluz
authored andcommitted
! prefix referencing templates
1 parent 60695e5 commit a0aec31

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

templating.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,9 @@ template living inside the AcmeBlogBundle, for example, can be overridden
410410
by placing a template of the same name in the ``app/Resources/AcmeBlogBundle/views/``
411411
directory. This gives the power to override templates from any vendor bundle.
412412

413+
If you have overridden a template, you can use the "!" prefix to refer to the original bundle's
414+
template. E.g. ``@!AcmeBlog/layout.html.twig``
415+
413416
Template Suffix
414417
~~~~~~~~~~~~~~~
415418

templating/overriding.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ from the bundle to ``app/Resources/AcmeBlogBundle/views/Blog/index.html.twig``
1919
(the ``app/Resources/AcmeBlogBundle`` directory won't exist, so you'll need
2020
to create it). You're now free to customize the template.
2121

22+
.. versionadded:: 3.4
23+
24+
Instead of overridding an entire template, you may just want to override one or more blocks. You can do that by extending the original
25+
template using the "!" prefix. For example:
26+
``{% extends "@!AcmeBlogBundle/layout.html.twig" %}``
27+
2228
.. caution::
2329

2430
If you add a template in a new location, you *may* need to clear your

0 commit comments

Comments
 (0)