zend framework 2 list modules in layout -
i want have plug-in system (like wordpress ) , how can list admin controller in layout.phtml ?
the list of modules if available in module manager (zend\modulemanager\modulemanager). can module manager via service locator. example in controller:
class mycontroller extends abstractactioncontroller { public function indexaction() { $manager = $this->getservicelocator()->get('modulemanager'); $modules = $manager->getloadedmodules(); } } the controllers have access layout (and parameters) via layout controller plugin.
$this->layout()->modules = $modules; an alternative create view helper. in view helper, module manager , return list of modules.
Comments
Post a Comment