Perform the following steps for setting the module layout using ZF events:
Create a new layout for the My Account page and save it under
CommunicationApp/module/Users/view/layout/myaccount-layout.phtml
.Add the layout to the
CommunicationApp/module/Users/config/module.config.php
file underview_manager -> template_map
:'layout/myaccount' => __DIR__ . '/../view/layout/myaccount-layout.phtml',
Open the
CommunicationApp/module/Users/module.php
file and add references toMvcEvent
:use Zend\Mvc\MvcEvent;
Overwrite the
onBootStrap()
method with the following code:public function onBootstrap($e) { $eventManager = $e->getApplication()->getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener->attach($eventManager); $sharedEventManager = $eventManager->getSharedManager(); // The shared event manager $sharedEventManager->attach(__NAMESPACE__, MvcEvent::EVENT_DISPATCH, function($e)...