Answer the question
In order to leave comments, you need to log in
How to add container to layout in M2 for only 2columms-left pages?
I can’t understand, it is necessary to add a container to 2-column pages in a custom module, more specifically, add divs something like another sidebar, inside colunms, at the same level as sidebar main and sidebar additional.
It seems that everything should be simple, in the layout folder of the module - vendor/my_vendor/mymodule/view/frontend/layout I create default.xml , in which I create the container I need
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="columns">
<container name="div.sidebar.alt" htmlTag="div" htmlClass="sidebar sidebar-main-alt" after="div.sidebar.main">
<container name="sidebar.alt" as="sidebar_alt" label="Sidebar Main Alternative">
<block>
...тут содержимое блока
</block>
</container>
</container>
</referenceContainer>
</body>
</page>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question