diff --git a/Module.php b/Module.php index 019a842..8917670 100644 --- a/Module.php +++ b/Module.php @@ -8,10 +8,11 @@ public function onBootstrap($e) $e->getApplication()->getEventManager()->getSharedManager()->attach('Zend\Mvc\Controller\AbstractController', 'dispatch', function($e) { $controller = $e->getTarget(); $controllerClass = get_class($controller); - $moduleNamespace = substr($controllerClass, 0, strpos($controllerClass, '\\')); $config = $e->getApplication()->getServiceManager()->get('config'); - if (isset($config['module_layouts'][$moduleNamespace])) { - $controller->layout($config['module_layouts'][$moduleNamespace]); + foreach($config['module_layouts'] as $module_namespace => $layout){ + if(false !== strpos($controllerClass, $module_namespace."\\")){ + $controller->layout($layout); + } } }, 100); }