Project

General

Profile

Actions

Feature #88888

closed

Add signalSlot dispatch to ActionController emitBeforeCallActionMethodSignal

Added by Stig Nørgaard Færch over 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Start date:
2019-08-02
Due date:
% Done:

0%

Estimated time:
PHP Version:
7.2
Tags:
Complexity:
easy
Sprint Focus:

Description

I was trying to find a signal to use when an action was called in ext:form.
There was no signal in ext:form, but in ActionController which ext:form extends I found the signal "beforeCallActionMethod".
To connect to this signal, I have to define the class TYPO3\CMS\Extbase\Mvc\Controller\ActionController, but that also means that on every action call on any extbase class which is extending ActionController, my slot is called.

My suggestion is to add another signal dispatch, but using get_called_class() instead of the CLASS constant.

Index: public/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- public/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php    (date 1564749545000)
+++ public/typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php    (date 1564749545000)
@@ -337,6 +337,7 @@
     protected function emitBeforeCallActionMethodSignal(array $preparedArguments)
     {
         $this->signalSlotDispatcher->dispatch(__CLASS__, 'beforeCallActionMethod', [static::class, $this->actionMethodName, $preparedArguments]);
+        if(get_called_class() !== __CLASS__) $this->signalSlotDispatcher->dispatch(get_called_class(), 'beforeCallActionMethod', [static::class, $this->actionMethodName, $preparedArguments]);
     }

     /**

Actions

Also available in: Atom PDF