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">
     <head>
         <css src="Blackbird_ContentManager::css/content.css" />
     </head>
     <body>
         <referenceContainer name="content">
             <referenceBlock name="page.main.title" remove="true"/>
             <block class="Blackbird\ContentManager\Block\View" name="contentmanager_view" />
         </referenceContainer>
     </body>
  </page>

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

  <CONTENT_TYPE_VIEW_blog>
  <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>
      </block>
  </reference>
  </CONTENT_TYPE_VIEW_blog>


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

  <CONTENT_LIST_VIEW_archive>
  <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>
      </block>
  </reference>
  </CONTENT_LIST_VIEW_archive>