ZF-6704: We cant setup plugin options for Zend_Application_Resource_Frontcontroller

Issue Type: Improvement Created: 2009-05-17T12:45:23.000+0000 Last Updated: 2009-08-21T09:34:43.000+0000 Status: Resolved Fix version(s): Reporter: Mathieu Delisle (m4d3l) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Application

Related issues: - ZF-6694



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;


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:

  • Create a resource method or plugin that does this work for you. It might pull configuration options from the bootstrap and pass them to selected plugins, or simply instantiate the plugins directly and pass them into the front controller.
  • Extend existing plugins to specify your desired defaults, and then specify this pre-configured plugin class to the front controller resource.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.