diff --git a/templating.rst b/templating.rst index 00cd2c27602..7f5203bb97c 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 5247c155aa0..cda4a16bdf5 100644 --- a/templating/overriding.rst +++ b/templating/overriding.rst @@ -19,6 +19,11 @@ from the bundle to ``templates/bundles/AcmeBlogBundle/Blog/index.html.twig`` (the ``templates/bundles/AcmeBlogBundle/`` directory won't exist, so you'll need to create it). You're now free to customize the template. +If you don't want to override the entire template but instead just want to +override a block, as of Symfony 3.4 you can now do with 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