Magento – How to override top.links in magento 2

magento2overridestoplinks

I am trying to override sign in and register link in magento 2. can any one please help me on this.

Best Answer

The top.links can be overriten in defaul.xml of your theme something like:

<referenceBlock name="top.links">
    <block class="Magento\Customer\Block\Account\Link" name="my-account-link">
        <arguments>
            <argument name="label" xsi:type="string" translate="true">My Account</argument>
        </arguments>
    </block>
    <block class="Magento\Customer\Block\Account\RegisterLink" name="register-link">
        <arguments>
            <argument name="label" xsi:type="string" translate="true">Create an Account</argument>
        </arguments>
    </block>
    <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link"
           template="account/link/authorization.phtml"/>
</referenceBlock>

You can see that the AuthorisationLink has a template, you can edit that template to add the popup functionality, also for the "register-link" you can create a template and create desired functionality. Also for the popul functionality check Magento2 Modal component in the devdocs http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/widgets/widget_modal.html

Related Topic