Important
You are browsing the documentation for version 4.2 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.
See our Release Process documentation for more information on the currently supported and upcoming releases.
Templates (Twig)¶
OroPlatform-based application uses the Twig templating engine to render the content.
- See the detailed documentation in:
Find Twig Templates¶
To find the Twig template file and Twig block that is used for rendering specific block of a content, you can use Twig Inspector. The inspector enables you to navigate instantly from a Browser to the Twig template that opens automatically in a PhpStorm.
Override Twig Templates¶
You can override one of the platform templates by adding a template
to the same path under src/Resources/
.
For example, to override the Grid/widget/widget.html.twig
template
from the DataGridBundle, create a new template file located at
src/Resources/OroDataGridBundle/views/Grid/widget/widget.html.twig
.
Note
Keep in mind that templates that are referenced by twig namespaces with @
(ex. @Twig/Exception/exception.html.twig
) can be overridden in both
src/Resources/
and templates/bundles
. As most of the templates are still
referenced by deprecated Symfony notation (ex. TwigBundle:Exception:exception.html.twig
), they
can be overridden only in src/Resources
. To be on the safe side, it is recommended
to override everything only in src/Resources
.