Commit cc0edc60 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Activation d'un layout spécial si la requête est de type AJAX. Valable pour...

Activation d'un layout spécial si la requête est de type AJAX. Valable pour TOUS les modules de l'application.
parent 55ea9514
......@@ -20,6 +20,16 @@ class Module
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
/* Active un layout spécial si la requête est de type AJAX. Valable pour TOUS les modules de l'application. */
$eventManager->getSharedManager()->attach('Zend\Mvc\Controller\AbstractActionController', 'dispatch',
function (MvcEvent $e) {
$request = $e->getRequest();
if ($request instanceof HttpRequest && $request->isXmlHttpRequest()) {
$e->getTarget()->layout('layout/ajax.phtml');
}
}
);
}
public function getConfig()
......
<?php
echo $this->content;
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment