1

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

3 Answers 3

2
<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

4
  • @Juliano Vargas is that works? Commented Nov 15, 2017 at 20:04
  • Great! thanks. actually the correct name was page.main.title Do you know where I can find all this names like a list of it? Commented Nov 15, 2017 at 20:14
  • added :) that file Commented Nov 15, 2017 at 20:17
  • perfect answer!!! +1 made my day :) Commented Oct 8, 2020 at 7:04
1

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.

1

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

<move element="custom.view.container" destination="columns.top" before="page.messages" />
1
  • Thanks this work too ! is there a list of this names tha one can refer to? Commented Nov 15, 2017 at 20:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.