Project

General

Profile

Actions

Feature #88888

closed

Add signalSlot dispatch to ActionController emitBeforeCallActionMethodSignal

Added by Stig Nørgaard Færch over 5 years ago. Updated about 4 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 #1

Updated by Benni Mack about 4 years ago

  • Status changed from New to Closed

Hey Stig,

check the new TYPO3 v10 Event Dispatcher and the BeforeActionCallEvent which hands over the target class name via static::class which should work as expected, as you check the class name as the first argument.

Actions

Also available in: Atom PDF