preDispatch vs. preDispatchType

  • Thread starter Thread starter ragtek
  • Start date Start date
R

ragtek

Guest
PHP:
**
     * Method designed to be overridden by child classes to add pre-dispatch
     * behaviors. This differs from {@link _preDispatch()} in that it is designed
     * for abstract controller type classes to override. Specific controllers
     * should override preDispatch instead.
     *
     * @param string $action Action that is requested
     */
    protected function _preDispatchType($action)
    {
    }

I don't understand this, where's now the difference between preDispatch and preDispatchType
Can anybody explain this, or give me a example?;)
 
_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:
PHP:
	final public function preDispatch($action)
	{
		...
		$this->_preDispatchType($action);
		$this->_preDispatch($action);
		...
	}
 
Top Bottom