How is the layout system in Magento 2 actually working? It’s driving me crazy.

The layout system in Magento 2 is driving me crazy. Could anybody please help me to understand it?

I have the following default.xml in


<referenceContainer name="header-wrapper"> <container name="header-wrapper" before=""> <block class="MagentoFrameworkViewElementTemplate" name="test" template="Magento_Theme::html/custom.phtml" /> </container> </referenceContainer> 

The expected outcome was to insert custom.phtml before

custom.phtml is in


Here is a screenshot with the block names:

So I expected the new block to be on the left side of “”

Here is the actual outcome:

It’s driving me crazy. I tried the whole day but I don’t understand the layout system of Magento 2.

Could anybody help me?

submitted by /u/zlep
[link] [comments]