[TASK] Signal for BackendUtility::getPagesTSconfig() 02/31002/2
authorAlexander Stehlik <alexander.stehlik@gmail.com>
Fri, 20 Jun 2014 11:58:23 +0000 (13:58 +0200)
committerNicole Cordes <typo3@cordes.co>
Sat, 21 Jun 2014 14:46:20 +0000 (16:46 +0200)
A signal is dispatched in BackendUtility::getPagesTSconfig()
before the include lines are calculated.

This enables to supply additional PageTS for each page
programmatically, even in multi-site environments.

Releases: 6.3, 6.2
Resolves: #59703
Change-Id: I1cc1188eebbf6dee769c64a654339837e0cdce59
Reviewed-on: https://review.typo3.org/31002
Reviewed-by: Nicole Cordes
Tested-by: Nicole Cordes
typo3/sysext/backend/Classes/Utility/BackendUtility.php

index ab19225..55f3c27 100644 (file)
@@ -1176,6 +1176,7 @@ class BackendUtility {
                        foreach ($rootLine as $k => $v) {
                                $TSdataArray['uid_' . $v['uid']] = $v['TSconfig'];
                        }
+                       $TSdataArray = static::emitGetPagesTSconfigPreIncludeSignal($TSdataArray, $id, $rootLine, $returnPartArray);
                        $TSdataArray = TypoScriptParser::checkIncludeLines_array($TSdataArray);
                        if ($returnPartArray) {
                                return $TSdataArray;
@@ -4173,4 +4174,26 @@ class BackendUtility {
                return !empty($GLOBALS['TCA'][$table]['ctrl']['security']['ignoreRootLevelRestriction']);
        }
 
+       /**
+        * Get the SignalSlot dispatcher
+        *
+        * @return \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+        */
+       static protected function getSignalSlotDispatcher() {
+               return GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\SignalSlot\\Dispatcher');
+       }
+
+       /**
+        * Emits signal to modify the page TSconfig before include
+        *
+        * @param array $TSdataArray Current TSconfig data array - Can be modified by slots!
+        * @param int $id Page ID we are handling
+        * @param array $rootLine Rootline array of page
+        * @param boolean $returnPartArray Whether TSdata should be parsed by TS parser or returned as plain text
+        * @return array Modified Data array
+        */
+       static protected function emitGetPagesTSconfigPreIncludeSignal(array $TSdataArray, $id, array $rootLine, $returnPartArray) {
+               $signalArguments = static::getSignalSlotDispatcher()->dispatch(__CLASS__, 'getPagesTSconfigPreInclude', array($TSdataArray, $id, $rootLine, $returnPartArray));
+               return $signalArguments[0];
+       }
 }