Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2964733

Browse filesBrowse 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
Copy full SHA for 2964733

File tree

Expand file treeCollapse file tree

2 files changed

+9
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-0
lines changed

‎templating.rst

Copy file name to clipboardExpand all lines: templating.rst
+3Lines 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

Copy file name to clipboardExpand all lines: templating/overriding.rst
+6Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.