Content view uses default templates to render content unless custom view rules are used.
Those templates can be customized by means of container- and siteaccess-aware parameters.
Overriding the default template for common view types
Templates for the most common view types (content/full, line, embed, or block) can be customized by setting one the ezplatform.default.content_view_templates
variables:
Controller | ViewType | Parameter | Default value |
---|---|---|---|
ez_content:viewAction | full | ezplatform.default_view_templates.content.full | "EzPublishCoreBundle:default:content/full.html.twig" |
ez_content:viewAction | line | ezplatform.default_view_templates.content.line | "EzPublishCoreBundle:default:content/line.html.twig" |
ez_content:viewAction | embed | ezplatform.default_view_templates.content.embed | "EzPublishCoreBundle:default:content/embed.html.twig" |
ez_page:viewAction | n/a | ezplatform.default_view_templates.block | "EzPublishCoreBundle:default:block/block.html.twig" |
Example
Add this configuration to app/config/config.yml
to use app/Resources/content/view/full.html.twig
as the default template when viewing Content with the full
view type:
Customizing the default controller
The controller used to render content by default can also be changed. The ezsettings.default.content_view_defaults
container parameter contains a hash that defines how content is rendered by default. It contains a set of classic content view rules for the common view types. This hash can be redefined to whatever suits your requirements, including custom controllers, or even matchers.