Magento 2 get Helper function in XML

Option FollowSymLinks not allowed here

Create a dynamic link in the customer account.

Here you make the dynamic link as per your logic.

1) Define helper class {vendor}\{Module}\Helper\Data in navigation link

<?xml version="1.0"?> <page xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">     <body>         
<referenceBlock name="customer_account_navigation">           
  <block class="Magento\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-new-product-link" after="-">                 
<argument name="label" xsi:type="string">Some link</argument>                    
 <argument name="path" xsi:type="helper" helper="{Vendor}\{Module}\Helper\Data::getLink"></argument>                 
</referenceBlock>     </body> </page>

2) Now create Data.php at app/code/{Vendor}/{Module}/Helper/Data.php


namespace Vendor\Module\Helper;

class Data extends \Magento\Framework\App\Helper\AbstractHelper


public function getLink() {

//Do your logic and return link $link = "sales/order/mylink"; return $link;



Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top