[FEATURE] Introduce beforeCallActionMethod signal
authorAlexander Schnitzler <alex.schnitzler@typovision.de>
Fri, 4 Jan 2013 12:28:28 +0000 (13:28 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 5 Jan 2013 19:44:56 +0000 (20:44 +0100)
This patch introduces a signal for hooking in
right before calling the action method of the
controller. The slots are given the controller
name, the action name and the action arguments.

Relases: 6.1, 6.0
Resolves: #7397
Change-Id: Ieaa27be80b187f5b6b60296404079febac663bd2
Reviewed-on: https://review.typo3.org/17364
Reviewed-by: Mattias Nilsson
Reviewed-by: Wouter Wolters
Reviewed-by: Daniel Hürtgen
Tested-by: Daniel Hürtgen
Reviewed-by: Stefan Neufeind
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/extbase/Classes/Mvc/Controller/AbstractController.php
typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php

index 1033c52..268a700 100644 (file)
@@ -35,6 +35,12 @@ namespace TYPO3\CMS\Extbase\Mvc\Controller;
 abstract class AbstractController implements \TYPO3\CMS\Extbase\Mvc\Controller\ControllerInterface {
 
        /**
+        * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+        * @inject
+        */
+       protected $signalSlotDispatcher;
+
+       /**
         * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
         */
        protected $objectManager;
index 4b49ae3..0bc4efa 100644 (file)
@@ -280,6 +280,7 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
                                        $shouldCallActionMethod = FALSE;
                                }
                                if ($shouldCallActionMethod) {
+                                       $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeCallActionMethod', array('controllerName' => get_class($this), 'actionMethodName' => $this->actionMethodName, 'preparedArguments' => $preparedArguments));
                                        $actionResult = call_user_func_array(array($this, $this->actionMethodName), $preparedArguments);
                                } else {
                                        $actionResult = call_user_func(array($this, $this->errorMethodName));
@@ -294,6 +295,7 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
                        if ($this->argumentsMappingResults->hasErrors()) {
                                $actionResult = call_user_func(array($this, $this->errorMethodName));
                        } else {
+                               $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeCallActionMethod', array('controllerName' => get_class($this), 'actionMethodName' => $this->actionMethodName, 'preparedArguments' => $preparedArguments));
                                $actionResult = call_user_func_array(array($this, $this->actionMethodName), $preparedArguments);
                        }
                }