8000 minor #8760 ! prefix referencing templates (silverbackdan) · symfony/symfony-docs@2964733 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2964733

Browse files
committed
minor #8760 ! prefix referencing templates (silverbackdan)
This PR was squashed before being merged into the 3.4 branch (closes #8760). Discussion ---------- ! prefix referencing templates #8440 Commits ------- a0aec31 ! prefix referencing templates
2 parents 04577e9 + a0aec31 commit 2964733

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
@@ -365,6 +365,9 @@ template living inside the AcmeBlogBundle, for example, can be overridden
365365
by placing a template of the same name in the ``app/Resources/AcmeBlogBundle/views/``
366366
directory. This gives the power to override templates from any vendor bundle.
367367

368+
If you have overridden a template, you can use the "!" prefix to refer to the original bundle's
369+
template. E.g. ``@!AcmeBlog/layout.html.twig``
370+
368371
Template Suffix
369372
~~~~~~~~~~~~~~~
370373

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)
0