سؤال

I was working with the layout xml for the top links. My code is in my custom module default.xml:

<?xml version="1.0"?>

<body>
    <referenceBlock name="header.links">
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="storelocator-link">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">Title Link</argument>
                <argument name="path" xsi:type="string">link-uri</argument>
            </arguments>
        </block>
    </referenceBlock>
</body>

Now I can get my link in top.links area. But it shows at the beginning. I like to move it at the end... But I can't able to move it. Can anyone help me to fix its position to the end..

هل كانت مفيدة؟

المحلول

try this it helps you if it work accept the answer it help others

<?xml version="1.0"?>
<body>
  <referenceBlock name="header.links">
        <block class="Magento\Customer\Block\Account\RegisterLink" name="register-link-new"  after="-">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">Create an Account</argument>
            </arguments>
        </block>
        <block class="Magento\Framework\View\Element\Html\Link\Current" name="storelocator-link" after="register-link-new">
            <arguments>
                <argument name="label" xsi:type="string" translate="true">Title Link</argument>
                <argument name="path" xsi:type="string">link-uri</argument>
            </arguments>
        </block>
    </referenceBlock>
    <referenceBlock name="register-link" remove="true"/>


</body>

نصائح أخرى

Try to place your module after the module(s)that place the other links, I mean as dependecie of the other(s) module(s).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top