Extension Magento Advanced Content Manager 2
Pour Magento 1
Pour Magento 2

Dynamic Layout Handle

A layout handle is a XML tag which allow to determine which blocks are loaded depending on the current path.

For example, contentmanager_index_content is the handle which will be used on a content view page.

The default layout for a content view is:

  <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
         <css src="Blackbird_ContentManager::css/content.css" />
         <referenceContainer name="content">
             <referenceBlock name="page.main.title" remove="true"/>
             <block class="Blackbird\ContentManager\Block\View" name="contentmanager_view" />

The dynamic layout handle will permits to add specific block or layout for a defined content type.

Let's say we want to add a cms block in the left column of our blog content type. We will use then CONTENT_TYPE_VIEW_blog as specific handle

  <reference name="left">
      <block class="""Magento\Cms\Block\Block" name="my-custom-block">
          <action method="setBlockId"><argument name=”block_id” xsi:type=”string”>my-custom-block</argument></action>

Let's say we want to add a cms block in the left column of our archive content list (only created from the backend). We will use then CONTENT_LIST_VIEW_archive as specific handle

  <reference name="left">
      <block class="Magento\Cms\Block\Block" name="my-custom-block">
          <action method"setBlockId"><argument name=”block_id” xsi:type=”string”>my-custom-block</argument></action>