[*] PROJECT : Adding hook on dispatcher

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15359 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
fSerny
2012-05-17 11:50:28 +00:00
parent 63041b0b31
commit 53d16fd889
+13 -1
View File
@@ -267,6 +267,7 @@ class DispatcherCore
if (!isset($controllers[$this->controller]))
$this->controller = $this->controller_not_found;
$controller_class = $controllers[$this->controller];
$paramsHookActionDispatcher = array('controller_type' => self::FC_FRONT, 'controller_class' => $controller_class, 'is_module' => 0);
break;
// Dispatch module controller for front office
@@ -283,6 +284,7 @@ class DispatcherCore
$controller_class = $module_name.$this->controller.'ModuleFrontController';
}
}
$paramsHookActionDispatcher = array('controller_type' => self::FC_FRONT, 'controller_class' => $controller_class, 'is_module' => 1);
break;
// Dispatch back office controller + module back office controller
@@ -308,6 +310,7 @@ class DispatcherCore
$controller_class = $controllers[$this->controller].(strpos($controllers[$this->controller], 'Controller') ? '' : 'Controller');
}
}
$paramsHookActionDispatcher = array('controller_type' => self::FC_ADMIN, 'controller_class' => $controller_class, 'is_module' => 1);
}
else
{
@@ -315,6 +318,7 @@ class DispatcherCore
if (!isset($controllers[$this->controller]))
$this->controller = $this->controller_not_found;
$controller_class = $controllers[$this->controller];
$paramsHookActionDispatcher = array('controller_type' => self::FC_ADMIN, 'controller_class' => $controller_class, 'is_module' => 0);
if (file_exists(_PS_ADMIN_DIR_.'/tabs/'.$controller_class.'.php'))
$retrocompatibility_admin_tab = _PS_ADMIN_DIR_.'/tabs/'.$controller_class.'.php';
@@ -337,7 +341,15 @@ class DispatcherCore
// Instantiate controller
try
{
Controller::getController($controller_class)->run();
// Loading controller
$controller = Controller::getController($controller_class);
// Execute hook dispatcher
if (isset($paramsHookActionDispatcher))
Hook::exec('actionDispatcher', $paramsHookActionDispatcher);
// Running controller
$controller->run();
}
catch (PrestaShopException $e)
{