문제

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