I am trying to add the custom link on customer dashboard in magento 2.
I have added
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="customer_account_navigation">
<block class="Magento\Framework\View\Element\Html\Link\Current" name="demo-link">
<arguments>
<argument name="path" xsi:type="string">module/controller/action</argument>
<argument name="label" xsi:type="string">Demo Link</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
on my module.Actually i have followed http://webkul.com/blog/magento2-add-link-in-my-account-navigation-panel/ . I changed the path to my module controller.Till here it is working good.
But there are two things that i couldn't achieve:
one is When i click on that tab it is redirecting to me to the entirely new page.The page that was defined on my layout's xml file. so I added the code of updating the handle of customer account. see my xml file.
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<body>
<referenceContainer name="content">
<block class="Custom\Addprofile\Block\Index\Index" name="index.index" template="Custom_Addprofile::index/index.phtml"/>
</referenceContainer>
</body>
</page>
This is still not working as expected. The template should load aside of the left navigation links on the account dashboard.
Am I missing some thing here?
- Also Another thing i was trying achieve is i want to display that custom tab to particular customer group only. Is there any easy way of achieving that?