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="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\Customer\Block\Account\SortLinkInterface" name="customer-account-navigation-new-product-link" after="-">                 
<arguments>                     
<argument name="label" xsi:type="string">Some link</argument>                    
 <argument name="path" xsi:type="helper" helper="{Vendor}\{Module}\Helper\Data::getLink"></argument>                 
</arguments>             
</block>         
</referenceBlock>     </body> </page>

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

<?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;

}
}

Refer

Leave a Reply

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

Back To Top