Execution order of the controller’s functions : classes/controller/Controller.php :

  1. __construct()
  2. run() (called by par Dispatcher->dispatch)
    1. checkAccess()
    2. init()
      1. AdminController->init():
        1. check employee
        2. $this->initProcess();
          1. if $_POST filter, $this->filter = true
          2. Define $this->action based on different conditions
          3. $this->action = delete_image delete status position save new view details export reset_filters toCamelCase Tools::getValue(action) update_fields bulk
          4. can error ‘You do not have permission to view/edit/add/delete this’
        3. $this->initBreadcrumbs();
        4. $this->initModal();
        5. $this->initToolbarFlags();
          1. $this->getLanguages
          2. $this->initToolbar
          3. $this->initTabModuleList
          4. $this->initPageHeaderToolbar
            1. $this->loadObject [in ‘view’ or ‘edit’] can error The object cannot be loaded (or found) or ‘The object cannot be loaded (the identifier is missing or invalid)’
        6. $this->initNotifications();
      2. FrontController->init()
        1. // todo
    3. setMedia() or setMobileMedia(): Adds all JavaScript and CSS specifics to the page so that they can be combined, compressed and cached (see PrestaShop’s CCC tool, in the back office “Performance” page, under the “Advanced preferences” menu).
    4. AdminController->setMedia()
      1. $this->addCSS(themes, css, public, vendor)
      2. $this->addJS(themes, css, public, vendor, public bundle)
    5. postProcess()
      1. AdminController->postProcess()
        1. $this->processFilter() [if !$this->ajax && $this->filter]
        2. Hook actionAdmin{Action}Before
        3. Hook action{Class}{Action}Before
        4. process{Action} (or ajaxProcess{Action} if $this->ajax)
        5. Hook actionAdmin{Action}After
        6. Hook action{Class}{Action}After
      2. FrontController->postProcess()
    6. redirect() [if $this->redirect_after]
    7. initHeader()
    8. initContent()
      1. AdminController->initContent
        1. $this->viewAccess
        2. $this->loadObject(true)
        3. [if display == ‘edit’   ‘add’]
          1. loadObject(true)
          2. renderForm
        4. [if display == ‘view’]
          1. loadObject(true)
          2. renderView
        5. [if display == ‘details’]
          1. renderDetails
        6. elseif !$this->ajax
          1. $this->renderModulesList()
          2. $this->renderKpis()
          3. $this->renderList()
          4. $this->renderOptions()
          5. $this->displayRequiredFields [if $this->required_database]
        7. assign ‘content’
      2. FrontController->initContent
        1. // todo
    9. initFooter()
    10. displayAjax() [if $this->ajax]
    11. display() [else]
      1. FrontController->smartyOutputContent
      2. AdminController->smartyOutputContent($this->layout)

test:

Function Condition Hook
1. __construct
2. run() (called by par Dispatcher->dispatch)