There is a service called `ControllerPluginManager` (
https://github.com/zendframework/zf2/blob/release-2.2.5/library/Zend/Mvc/Service/ServiceListenerFactory.php#L46)
which is a plugin manager (specialization of a service manager) that
you
can inject in whatever service is implementing `__call` with the same
approach of the `AbstractController` (
https://github.com/zendframework/zf2/blob/release-2.2.5/library/Zend/Mvc/Controller/AbstractController.php#L288-L306).

If you want to add more plugins, you can use the configuration key
`controller_plugins` (
https://github.com/zendframework/zf2/blob/release-2.2.5/library/Zend/Mvc/Service/ModuleManagerFactory.php#L58-L63)
as a service manager configuration (
https://github.com/zendframework/zf2/blob/release-2.2.5/library/Zend/ServiceManager/Config.php).

Adding services to `controller_plugins` makes them available as helper
methods within abstract controllers that got that plugin manager injected
:-)

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/


On 21 November 2013 23:41, Nitro <[email protected]> wrote:

> ZF2 controllers come with several built-in plugins (eg: url, etc)
> If i wanted to add some of my own, what would be the best way to do this?
>
> I'm still trying to understand how to put things together with ZF2.
> I really like the concepts involved, the problem is to get things together.
>
> Would be nice to have some real world applications, to see how things can
> work together.
>
> At the moment it feels like a big puzzle.
> I hate to ask for help, but i got no alternative since google seems not to
> help much ;)
>
>
>
>
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Sharing-controller-plugins-across-all-modules-tp4661254.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
> --
> List: [email protected]
> Info: http://framework.zend.com/archives
> Unsubscribe: [email protected]
>
>
>

Reply via email to