15

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>

2 Answers 2

45

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

0
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.