php - How to add actions in controller of third party module in Zend Framework 2 -
i using zfcuser module. have seen wiki , here have find out how override views of existing actions in controllers of zfcuser. question is, how add action e.g. changedisplaypictureaction().
the approach used create custom module, configure out module.config.php way
return array( 'controllers' => array( 'invokables' => array( 'zfcuser' => 'mynamespace\controller\usercontroller', ), ), ); i extended usercontroller zfcuser\controller\usercontrollerbut because created new actions in along new views. there no way point parent-class actions views have in parent module. in other words, have copy views in module child or final class exists. otherwise getting error message
zend\view\renderer\phprenderer::render: unable render template "my-user/profile/index"; resolver not resolve file all want add new actions in third party modules without disturbing them extending them.
thanks.
if not planning change existing functionality, why extend it? create new controller , have route configured correctly dispatches new actions towards new controller , let existing controller handle existing actions.
return array( 'controllers' => array( 'invokables' => array( 'myuser' => 'mynamespace\controller\usercontroller, ), ), 'router' => array( 'routes' => array( 'myuser' => array( 'type' => 'literal', 'options' => array( 'route' => '/user/change-display-picture', 'defaults' => array( 'controller' => 'myuser', 'action' => 'change-display-picture', ), ), ), ), ), );
Comments
Post a Comment