Question

I would like to add a div inside <main id="maincontent" class="page-main"> from my custom module please look at screen shoot:

enter image description here

Can you see a class="MYCUSTOMBLOCKHERE" in the image I need to add this div.

Any help I Appreciate. Thanks

Was it helpful?

Solution 2

Ok I've manage to ad like this But...

    <referenceContainer name="columns.top">
        <container name="custom.view.container" htmlTag="div" htmlClass="custom-view" after="page.title.wrapper">
            <block class="company\module\Block\entity" name="customView" template="company_module::custom.phtml" />
        </container>
    </referenceContainer>

But it adds after page messages not before.

OTHER TIPS

<referenceContainer name="columns.top">
    <container name="custom.view.container" htmlTag="div" htmlClass="custom-view" before="page.messages">
        <block class="company\module\Block\entity" name="customView" template="company_module::custom.phtml" />
    </container>
</referenceContainer>

Flush cache and clear cache and check it.

you can find all block name into

vendor\magento\module-theme\view\frontend\layout\default.xml

Add <move> tag to make it before page messgae.

<move element="custom.view.container" destination="columns.top" before="page.messages" />
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top