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 a0aec31

Browse filesBrowse files
silverbackdanjaviereguiluz
authored andcommitted
! prefix referencing templates
1 parent 60695e5 commit a0aec31
Copy full SHA for a0aec31

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
@@ -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

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.