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:

ControllerViewTypeParameterDefault value
ez_content:viewActionfullezplatform.default_view_templates.content.full"EzPublishCoreBundle:default:content/full.html.twig"
ez_content:viewActionlineezplatform.default_view_templates.content.line"EzPublishCoreBundle:default:content/line.html.twig"
ez_content:viewActionembedezplatform.default_view_templates.content.embed"EzPublishCoreBundle:default:content/embed.html.twig"
ez_page:viewActionn/aezplatform.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:

parameters:
    ezplatform.default_view_templates.content.full: "content/view/full.html.twig"

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.

 

Related topics: