I am trying to add helper function to cms block or page but it didn't parse like other directives.can anyone help to resolve this issue.or how make helper directive to work in cms block or cms page.

class Mage_Customer_Helper_Data extends Mage_Core_Helper_Abstract
    public function useInWysiwygEditor{
    /* logic should be anything */
        return $this->getUrl('contact')

now in cms editor i want to use like {{helper useInWysiwygEditor()}}



1 Answer 1


I have created one custom module for this

and we have specified the our filter to magento by adding the following code in config.xml page


Then create the file [Namespace]/[Module]/Model/Template/Filter.php

class [Namespace]_[Module]_Model_Template_Filter extends Mage_Widget_Model_Template_Filter
    public function helperDirective($construction)
        $params = $this->_getIncludeParameters($construction[2]);
        $allowedParams = array('module', 'method', 'params');
        if(empty($params) || !count(array_intersect($allowedParams, array_keys($params)))){
            return $construction[0];
        if((isset($params['module']) && !empty($params['module'])) && (isset($params['module']) && !empty($params['module']))){
                $helper = Mage::helper($params['module']);
                if(is_callable(array($helper, $params['method']), true, $params['method'])){
                    $arg = array();
                    $method = $params['method'];
                    if(isset($params['params']) && !empty($params['params'])){
                        $arg = explode(',',$params['params']);
                    return call_user_func_array(array($helper, $method), $arg);
            } catch (Exception $e){
                return $construction[0];
        return $construction[0];

Note: here the function name is helperDirective. if you that to {{custom }} so the function name will customDirective (i.e,{{youname}}Directive)

Then I have use 3 parameters for this.

So you can call your helper function by following way

{{helper module="yourmodule" method="yourfunction" params="arg1,arg2,..etc"}}


module => 'module helper name'

method => 'function name'

params => 'parameters of the function'

I have created this module by following this tutorial

  • Its working perfectly mate.Thanks. But i confused about tempate_filter i thought it should be template_filter :)
    – Zahirabbas
    Nov 15, 2018 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.