1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

preDispatch vs. preDispatchType

Discussion in 'XenForo Development Discussions' started by ragtek, Oct 21, 2010.

  1. ragtek

    ragtek Guest

    Method designed to be overridden by child classes to add pre-dispatch
    behaviorsThis differs from {@link _preDispatch()} in that it is designed
    * for abstract controller type classes to overrideSpecific controllers
    should override preDispatch instead.
         * @
    param string $action Action that is requested
        protected function 
    I don't understand this, where's now the difference between preDispatch and preDispatchType
    Can anybody explain this, or give me a example?;)
  2. g0rn

    g0rn Well-Known Member

    _preDispatchType is overridden in abstract controllers like XenForo_ControllerPublic_Abstract (here among other things we check that the user is not banned as we need to check that in all public controllers) and XenForo_ControllerAdmin_Abstract. _preDispatch is overridden in specific controllers that extends abstract controllers, an example would be XenForo_ControllerAdmin_AddOn (it extends XenForo_ControllerAdmin_Abstract and here we check admin's specific permission to manage add-ons).
    If you would look at the preDispatch method you will see that firstly executed abstract controller code and then specific controller code:
        final public function preDispatch($action)

Share This Page