I want to put the header.links into another block. this is the icon.phtml file:
<div data-block="dropdown" class="minicart-wrapper">
<i class='fas fa-user-circle action' data-trigger='trigger'></i>
</div>
the menu.phtml file:
<div id="links-menu" class="block block-minicart"
data-mage-init='{
"dropdownDialog": {
"appendTo": "[data-block=dropdown]",
"triggerTarget":"[data-trigger=trigger]",
"timeout": 2000,
"closeOnMouseLeave": false,
"closeOnEscape": true,
"autoOpen": false,
"triggerClass": "active",
"parentClass": "active",
"dialogContentClass": "active",
"buttons": []
}
}'>
content
</div>
This is the layout file:
<referenceContainer name="header-wrapper">
<block class="Magento\Framework\View\Element\Template" name="icon_account" as="icon_account" template="Magento_Customer::/icon/icon.phtml"/>
<block class="Magento\Framework\View\Element\Template" name="links-menu" as="links-menu" template="Magento_Customer::/menu/menu.phtml"/>
</referenceContainer>
<move element="header.links" destination="links-menu"/>
The problem is that the header.links are not into the desired destination. How can I fix it?
Full xml:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head> <!-- this is the css to render the icon of the account link -->
<css src="https://use.fontawesome.com/releases/v5.7.0/css/all.css" src_type="url"/>
</head>
<body>
<referenceBlock name="header.links">
<block class="Magento\Customer\Block\Account\Customer" name="customer" template="account/customer.phtml" before="-"/>
<block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login" template="account/link/authorization.phtml"/>
</referenceBlock>
<block class="Magento\Theme\Block\Html\Header" name="header" as="header">
<arguments>
<argument name="show_part" xsi:type="string">welcome</argument>
</arguments>
</block>
<move element="header" destination="header.links" before="-"/>
<move element="register-link" destination="header.links"/>
<move element="my-account-link" destination="header.links"/>
<move element="top.links" destination="customer"/>
<move element="authorization-link" destination="top.links" after="-"/>
<referenceBlock name="register-link" remove="true"/>
<referenceContainer name="header-wrapper">
<block class="Magento\Framework\View\Element\Template" name="icon_account" as="icon_account" template="Magento_Customer::/icon/icon.phtml"/>
<block class="Magento\Framework\View\Element\Template" name="links-menu" as="links-menu" template="Magento_Customer::/menu/menu.phtml"/>
</referenceContainer>
<move element="header.links" destination="links-menu"/>
<move element="icon_account" destination="header-wrapper" before="minicart"/>
<move element="top.search" destination="header-wrapper" after="logo"/>
</body>
</page>
<referenceBlock name="header.links">
– Ranganathan May 24 '19 at 9:48