Created
September 21, 2012 12:53
-
-
Save kaiohken1982/3761293 to your computer and use it in GitHub Desktop.
Zend framework 2 specific layout for a module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyModule; | |
use Zend\ModuleManager\ModuleManager; | |
class Module | |
{ | |
public function init(ModuleManager $moduleManager) | |
{ | |
$sharedEvents = $moduleManager->getEventManager()->getSharedManager(); | |
$sharedEvents->attach(__NAMESPACE__, 'dispatch', function($e) { | |
// This event will only be fired when an ActionController under the MyModule namespace is dispatched. | |
$controller = $e->getTarget(); | |
$controller->layout('layout/alternativelayout'); | |
}, 100); | |
} | |
} | |
// http://blog.evan.pro/module-specific-layouts-in-zend-framework-2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment