Skip to main content
3 of 3
added 8 characters in body
Prince Patel
  • 22.9k
  • 10
  • 98
  • 121

1) For ex: you have function getTitle() in Data.php at Namespace/Modulename/Helper

<?php

namespace Namespace\Modulename\Helper;

class Data extends \Magento\Framework\App\Helper\AbstractHelper
{
    public function getTitle()
    {
       return "Testing";
    }

}

2) In layout.xml change xsi:type="string" to xsi:type="helper" and define helper class::methodName

<block class="Magento\Framework\View\Element\Html\Link\Current" ifconfig="custommodule/general/enable_footer_link" name="custommodule-link">
<arguments>
    <argument name="label" xsi:type="string">Custom Module</argument>
    <argument name="path" xsi:type="helper" helper="Namespace\Modulename\Helper\Data::getTitle"/>
</arguments>
</block>
Prince Patel
  • 22.9k
  • 10
  • 98
  • 121