Napas
Napas

Reputation: 2801

How to extend/replace default action helper in Zend Framework

I need to override Zend_Controller_Action_Helper_Redictor method redirectAndExit().

I create My_Controller_Action_Helper_Redirector and put file with class in the right place. How to force ZF to use My_Controller_Action_Helper_Redirector instead Zend_Controller_Action_Helper_Redirector?

Upvotes: 1

Views: 609

Answers (1)

sallaigy
sallaigy

Reputation: 1654

Check out Zend_Controller_Action_HelperBroker. In your bootstrap file try this:

public function _initActionHelpers()
{
    $this->bootstrap('frontController')
    Zend_Controller_Action_HelperBroker::addHelper($myHelperClass);
}

If you override the getName() behaviour your helper should be called if you refer to the redirector.

Upvotes: 4

Related Questions