1

Referencing to this ticket: Magento 2 - Remove and change footer links

I have now the question if one can change the position from the respective links without removing them and reinitiating them afterwards.

Is there any sort parameter for XML?

<referenceBlock name="catalog-search-advanced-link" remove="true"/>
<referenceBlock name="search-term-popular-link" remove="true"/>
<referenceBlock name="sales-guest-form-link" remove="true"/>

<referenceBlock name="footer_links">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="ueber-uns">
            <arguments>
                <argument name="label" xsi:type="string">Über uns</argument>
                <argument name="path" xsi:type="string">ueber-uns</argument>
            </arguments>
        </block>
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="kundenservice">
            <arguments>
                <argument name="label" xsi:type="string">Kundenservice</argument>
                <argument name="path" xsi:type="string">customer-service</argument>
            </arguments>
        </block>
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="contact-us-link">
            <arguments>
                <argument name="label" xsi:type="string">Kontakt</argument>
<!--                 <argument name="path" xsi:type="string">customer-service</argument> -->
            </arguments>
        </block>
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="privacy-policy-link">
            <arguments>
                <argument name="label" xsi:type="string">Datenschutz</argument>
            </arguments>
        </block>
    </referenceBlock>

Results in:

Datenschutz
Kontakt
Über uns
Kundenservice

on the frontend (in this order), even if I declared "Über uns" BEFORE I changed the name of the contact-us-link and the privacy-policy-link

1

Just keep in default.xml file like below,

Using After and Before tag of xml you can use before or after element. before="-" means current block display before all other elements in its parent node.`

after="-" means current block display after all other elements in its parent node.

In our case parent node is footer_links based on this block before and after attributes are set.

<referenceBlock name="footer_links">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="ueber-uns" after="contact-us-link">
            <arguments>
                <argument name="label" xsi:type="string">Über uns</argument>
                <argument name="path" xsi:type="string">ueber-uns</argument>
            </arguments>
        </block>
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="kundenservice" after="ueber-uns">
            <arguments>
                <argument name="label" xsi:type="string">Kundenservice</argument>
                <argument name="path" xsi:type="string">customer-service</argument>
            </arguments>
        </block>
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="contact-us-link" after="privacy-policy-link">
            <arguments>
                <argument name="label" xsi:type="string">Kontakt</argument>
<!--                 <argument name="path" xsi:type="string">customer-service</argument> -->
            </arguments>
        </block>
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="privacy-policy-link" before="-">
            <arguments>
                <argument name="label" xsi:type="string">Datenschutz</argument>
            </arguments>
        </block>
    </referenceBlock>
| improve this answer | |
  • For future visitors of this request, could you dig a little deeper into the "after"-descriptor? That would help the community for future issues like this! However, it worked and I'll mark your reply as the right one as soon as you put in a little more information about the after-descriptor. – Max Aug 24 '16 at 13:12

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.