diff --git a/modules/concepts/hooks/list-of-hooks/actionInitAfter.md b/modules/concepts/hooks/list-of-hooks/actionInitAfter.md new file mode 100644 index 0000000000..ea4fc3730e --- /dev/null +++ b/modules/concepts/hooks/list-of-hooks/actionInitAfter.md @@ -0,0 +1,27 @@ +--- +Title: actionInitAfter +hidden: true +hookTitle: +files: + - + url: 'https://github.com/PrestaShop/PrestaShop/blob/9.0.x/classes/controller/FrontController.php' + file: classes/controller/FrontController.php +locations: + - 'front office' +type: action +hookAliases: +array_return: false +check_exceptions: false +chain: false +origin: core +description: 'This hook is called at the end of the initialization of Smarty variables, class properties of a Front Controller.' + +--- + +{{% hookDescriptor %}} + +## Call of the Hook in the origin file + +```php +Hook::exec('action' . $this->getControllerName() . 'InitAfter', ['controller' => $this]); +``` diff --git a/modules/concepts/hooks/list-of-hooks/actionInitBefore.md b/modules/concepts/hooks/list-of-hooks/actionInitBefore.md new file mode 100644 index 0000000000..55d5426178 --- /dev/null +++ b/modules/concepts/hooks/list-of-hooks/actionInitBefore.md @@ -0,0 +1,27 @@ +--- +Title: actionInitBefore +hidden: true +hookTitle: +files: + - + url: 'https://github.com/PrestaShop/PrestaShop/blob/9.0.x/classes/controller/FrontController.php' + file: classes/controller/FrontController.php +locations: + - 'front office' +type: action +hookAliases: +array_return: false +check_exceptions: false +chain: false +origin: core +description: 'This hook is called at the beginning of the initialization of a front controller, before it sets any Smarty variables, class properties, redirect depending on context, etc.' + +--- + +{{% hookDescriptor %}} + +## Call of the Hook in the origin file + +```php +Hook::exec('action' . $this->getControllerName() . 'InitBefore', ['controller' => $this]); +``` diff --git a/modules/concepts/hooks/list-of-hooks/actionSetMedia.md b/modules/concepts/hooks/list-of-hooks/actionSetMedia.md new file mode 100644 index 0000000000..bac037d778 --- /dev/null +++ b/modules/concepts/hooks/list-of-hooks/actionSetMedia.md @@ -0,0 +1,27 @@ +--- +Title: actionSetMedia +hidden: true +hookTitle: +files: + - + url: 'https://github.com/PrestaShop/PrestaShop/blob/9.0.x/classes/controller/FrontController.php' + file: classes/controller/FrontController.php +locations: + - 'front office' +type: action +hookAliases: +array_return: false +check_exceptions: false +chain: false +origin: core +description: 'This hook is called after a Front Controller has registered its Stylesheets and Javascripts. You can register more files in this hook.' + +--- + +{{% hookDescriptor %}} + +## Call of the Hook in the origin file + +```php +Hook::exec('action' . $this->getControllerName() . 'SetMedia'); +``` diff --git a/modules/concepts/hooks/list-of-hooks/actionSetVariables.md b/modules/concepts/hooks/list-of-hooks/actionSetVariables.md new file mode 100644 index 0000000000..2f70b38621 --- /dev/null +++ b/modules/concepts/hooks/list-of-hooks/actionSetVariables.md @@ -0,0 +1,36 @@ +--- +Title: actionSetVariables +hidden: true +hookTitle: +files: + - + url: 'https://github.com/PrestaShop/PrestaShop/blob/9.0.x/classes/controller/FrontController.php' + file: classes/controller/FrontController.php +locations: + - 'front office' +type: action +hookAliases: +array_return: false +check_exceptions: false +chain: false +origin: core +description: 'This hook is called after a Front Controller has set commonly used variables, available for use in the template. You can add/edit/remove variables from the array passed by reference. After the hook execution, this array of variables is assigned to Smarty.' + +--- + +{{% hookDescriptor %}} + +## Call of the Hook in the origin file + +```php +$modulesVariables = array_merge( + $modulesVariables, + Hook::exec('action' . $this->getControllerName() . 'SetVariables', + [ + 'templateVars' => &$templateVars, + ], + null, + true + ) +); +``` diff --git a/modules/concepts/hooks/list-of-hooks/actionSetVariablesBefore.md b/modules/concepts/hooks/list-of-hooks/actionSetVariablesBefore.md new file mode 100644 index 0000000000..5af45b9607 --- /dev/null +++ b/modules/concepts/hooks/list-of-hooks/actionSetVariablesBefore.md @@ -0,0 +1,32 @@ +--- +Title: actionSetVariablesBefore +hidden: true +hookTitle: +files: + - + url: 'https://github.com/PrestaShop/PrestaShop/blob/9.0.x/classes/controller/FrontController.php' + file: classes/controller/FrontController.php +locations: + - 'front office' +type: action +hookAliases: +array_return: false +check_exceptions: false +chain: false +origin: core +description: 'This hook is called before a Front Controller starts to set commonly used variables, that are going to be assigned to Smarty. You can add/edit/remove variables from the array passed by reference..' + +--- + +{{% hookDescriptor %}} + +## Call of the Hook in the origin file + +```php +Hook::exec('action' . $this->getControllerName() . 'SetVariablesBefore', + [ + 'templateVars' => &$templateVars, + 'cart' => $cart, + ] +); +``` diff --git a/modules/concepts/hooks/list-of-hooks/actionBuildFrontEndObject.md b/modules/concepts/hooks/list-of-hooks/actionBuildFrontEndObject.md new file mode 100644 index 0000000000..53d5cf59e0 --- /dev/null +++ b/modules/concepts/hooks/list-of-hooks/actionBuildFrontEndObject.md @@ -0,0 +1,29 @@ +--- +Title: actionBuildFrontEndObject +hidden: true +hookTitle: +files: + - + url: 'https://github.com/PrestaShop/PrestaShop/blob/9.0.x/classes/controller/FrontController.php' + file: classes/controller/FrontController.php +locations: + - 'front office' +type: action +hookAliases: +array_return: false +check_exceptions: false +chain: false +origin: core +description: 'This hook is called after the "prestashop" javascript object has been built to be sent to the front end. You can add/edit/remove variables from the array passed by reference. Those variables will be inserted in the "prestashop" javascript object.' + +--- + +{{% hookDescriptor %}} + +## Call of the Hook in the origin file + +```php +Hook::exec('actionBuild' . $this->getControllerName() . 'FrontEndObject', [ + 'obj' => &$object, +]); +``` diff --git a/modules/concepts/hooks/list-of-hooks/actionOutputHTMLBefore.md b/modules/concepts/hooks/list-of-hooks/actionOutputHTMLBefore.md new file mode 100644 index 0000000000..bc66e655c8 --- /dev/null +++ b/modules/concepts/hooks/list-of-hooks/actionOutputHTMLBefore.md @@ -0,0 +1,27 @@ +--- +Title: actionOutputHTMLBefore +hidden: true +hookTitle: +files: + - + url: 'https://github.com/PrestaShop/PrestaShop/blob/9.0.x/classes/controller/FrontController.php' + file: classes/controller/FrontController.php +locations: + - 'front office' +type: action +hookAliases: +array_return: false +check_exceptions: false +chain: false +origin: core +description: 'This hook is called just before Smarty output the HTML Content of the page. You can edit the HTML passed by reference.' + +--- + +{{% hookDescriptor %}} + +## Call of the Hook in the origin file + +```php +Hook::exec('actionOutput' . $this->getControllerName() . 'HTMLBefore', ['html' => &$html]); +``` diff --git a/modules/concepts/hooks/list-of-hooks/displayHeader.md b/modules/concepts/hooks/list-of-hooks/displayHeader.md new file mode 100644 index 0000000000..2a19ecffac --- /dev/null +++ b/modules/concepts/hooks/list-of-hooks/displayHeader.md @@ -0,0 +1,30 @@ +--- +Title: displayHeader +hidden: true +hookTitle: +files: + - + url: 'https://github.com/PrestaShop/PrestaShop/blob/9.0.x/classes/controller/FrontController.php' + file: classes/controller/FrontController.php +locations: + - 'front office' +type: display +hookAliases: +array_return: false +check_exceptions: false +chain: false +origin: core +description: 'This hook is called in the construction of the HOOK_HEADER Smarty variable. It is used for common front page header content.' + +--- + +{{% hookDescriptor %}} + +## Call of the Hook in the origin file + +```php +$this->context->smarty->assign([ + 'HOOK_HEADER' => Hook::exec('displayHeader') + . Hook::exec('display' . $this->getControllerName() . 'Header'), +]); +```