Question

I've added a new reference container inside of:

Magento_Theme/layout/default.xml

Here is my code for adding the new container:

<referenceContainer name="header.container">
    <!-- remove the header panel wrapper -->
    <container name="header.panel.wrapper" remove="true" />
    <!-- Add new container -->
    <container name="header.inner" as="header_inner" label="Page Header Inner" htmlTag="div" htmlClass="page-header__inner" before="-">
         <container name="header.top" as="header_top" label="Page Header Top " htmlTag="div" htmlClass="page-header__top" before="-">
                <container name="header.top.actions" as="header_top_actions" label="Page Header Top actions" htmlTag="div" htmlClass="page-header__actions" />
         </container>
    </container>
</referenceContainer>

I've then moved the minicart into this container like so:

<move element="minicart" destination="header.top.actions"/>

Which works fine, however when i try to move:

element="top.links"

Into this container like so:

<move element="top.links" destination="header.top.actions" before="-" />

The top.links don't want to move into my new reference container, and i can't understand why that one doesn't want to move there.

Any help would be great.

Était-ce utile?

La solution

So looks like you can't move an element which has been removed using xml. Simply commenting out the following:

<container name="header.panel.wrapper" remove="true" />

And making sure this is pointing at the correct block:

<move element="top.links" destination="header.top.actions" before="-" />

Will move the block into the correct area. Hope this helps people if they come across the same issue.

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top