Advanced content manager extension for Magento®
- a powerful CMS

Dynamic layout handle

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

The default layout (contentmanager_index_content) 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>

Content Type Layout Handle

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

Eg:
app/code/<Vendor>/<Module>/view/frontend/layout/CONTENT_TYPE_VIEW_blogor
app/design/frontend/<Vendor>/<Theme>/<Vendor_Module>/layout/CONTENT_TYPE_VIEW_blog

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
   <referenceContainer 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>
   </referenceContainer>
</layout>

Content List Layout Handle

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.

Eg:
app/code/<Vendor>/<Module>/view/frontend/layout/CONTENT_LIST_VIEW_archiveor
app/design/frontend/<Vendor>/<Theme>/<Vendor_Module>/layout/CONTENT_LIST_VIEW_archive

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
   <referenceContainer 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>
   </referenceContainer>
</layout>

100%
OpenSource

60 days
free support

Unlimited
updates

Made for developers
and webmasters

14 days money
back guarantee

Made by Magento
certified developers