diff --git a/templating.rst b/templating.rst index 58b6f566f1e..dcea6fff928 100644 --- a/templating.rst +++ b/templating.rst @@ -410,6 +410,9 @@ template living inside the AcmeBlogBundle, for example, can be overridden by placing a template of the same name in the ``app/Resources/AcmeBlogBundle/views/`` directory. This gives the power to override templates from any vendor bundle. +If you have overridden a template, you can use the "!" prefix to refer to the original bundle's +template. E.g. ``@!AcmeBlog/layout.html.twig`` + Template Suffix ~~~~~~~~~~~~~~~ diff --git a/templating/overriding.rst b/templating/overriding.rst index 6b5f96c6efe..6ef20f26e40 100644 --- a/templating/overriding.rst +++ b/templating/overriding.rst @@ -19,6 +19,12 @@ from the bundle to ``app/Resources/AcmeBlogBundle/views/Blog/index.html.twig`` (the ``app/Resources/AcmeBlogBundle`` directory won't exist, so you'll need to create it). You're now free to customize the template. +.. versionadded:: 3.4 + + Instead of overridding an entire template, you may just want to override one or more blocks. You can do that by extending the original + template using the "!" prefix. For example: + ``{% extends "@!AcmeBlogBundle/layout.html.twig" %}`` + .. caution:: If you add a template in a new location, you *may* need to clear your