nuxwin wrote > I am facing a small problem: > > I've two modules: > > DomainsManager > DnsManager (Optional module) > > The first module provides an action (addDomain) that allows an user to add > a new domain via a form. > > I want be able to extend that form with a partial view/form pulled from > the DnsManager module (if activated) to allow the user to specify whether > or not the DNS zone for that domain must be generated. > > I'm thinking about a specific event listener (provided by the DnsManager > module) to listen on the 'onAddDomain' event (provided the DomainManager > module) but I'm not sure it's the good way to do. If I do that way, that > mean that for each request, I will have to "register" that listener ?, > even if the current route do not match for an action provided by the > DomainManager module ? > > To resume, what I want do is a kind of widget system but I want avoid too > much hard dependencies between the modules. I would also avoid to use the > forward plugin into my module controllers since that involve hard > dependencies.
You could do a check for loaded/active Modules on loadModules.post event in your Module.php class firstly. Then in your getControllerConfig you can use a factory and ServiceManager to inject appropriate Form based on the Modules check result. Your DnsManager Form can extend a DomainsManager one or you could just add another fieldset to the DomainsManager Form. ----- Cheers, -- Luke Mierzwa -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Event-driven-Wigets-Form-generation-tp4656890p4656902.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com