11

Being newby I look for a workaround to move Sign in and Store switcher from header.panel to header.container. I just tried this code but won't work

<referenceContainer name="header.container">
        <referenceBlock  class="Magento\Store\Block\Switcher" name="store.settings.language" template="switch/languages.phtml"> </referenceBlock>
</referenceContainer>
36

There is a new move node in the layout xml that we have access to in M2. This node sets the declared block or container element as a child of another element in the specified order.

Example:

<move element="name.of.an.element" destination="name.of.destination.element" as="new_alias" after="name.of.element.after" before="name.of.element.before"/>

In the example you provided before you should just be able to call:

<move element="store.settings.language" destination="header.container" as="store_settings_language"/>

More information in the official M2 docs on <move> here: https://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-instructions.html#fedg_layout_xml-instruc_ex_mv

9

This is better:

<move element="store_language" destination="header.container" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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