ZF-6704: We cant setup plugin options for Zend_Application_Resource_Frontcontroller
Description
in Zend_Application_Resource_Frontcontroller near line 90. where the plugin is set, we can see no option can be pass to the plugin from the config file.
Actually : resources.frontController.plugins.myplugin = "My_Plugin" resources.frontController.plugins.errorhandler = "Zend_Controller_Plugin_ErrorHandler"
case 'plugins': foreach ((array) $value as $pluginClass) { $plugin = new $pluginClass(); $front->registerPlugin($plugin); } break;
I transfort that to like this :
resources.frontController.plugins.myplugin = "My_Plugin" (Old way alway work if no data need to be set) resources.frontController.plugins.errorhandler.classname = "Zend_Controller_Plugin_ErrorHandler" (new way to add options to the plugin.) resources.frontController.plugins.errorhandler.options.module = "default" resources.frontController.plugins.errorhandler.options.controller = "error" ...
case 'plugins': foreach ((array) $value as $pluginClass) { if (is_array($pluginClass)){ if (!isset($pluginClass['options'])){ $pluginClass['options'] = array(); } $plugin = new $pluginClass'classname'; }else{ $plugin = new $pluginClass(); } $front->registerPlugin($plugin); } break;
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2009-08-21T09:34:32.000+0000
The resource was never designed to do this. The reason is because there is no standard constructor argument for plugins -- meaning that we don't have a single approach that will work for any plugin referenced.
If you need to configure a given plugin, you have two options: