[FEATURE] Enhance info array provided to services
authorAlexander Stehlik <alexander.stehlik@googlemail.com>
Thu, 28 Apr 2011 13:10:30 +0000 (15:10 +0200)
committerJigal van Hemert <jigal@xs4all.nl>
Sun, 31 Jul 2011 12:39:37 +0000 (14:39 +0200)
In t3lib_div::makeInstanceService() the info array passed to
the instanciated service class is enhanced with information about
the requested service type, service sub type and the excluded service
keys.

Deprecated references to global vars have been replaced with $GLOBALS
array.

Change-Id: I45d39b3a526ab2c9a2ce273784ecdc4c3f03affd
Resolves: #26410
Reviewed-on: http://review.typo3.org/1776
Reviewed-by: Markus Klein
Reviewed-by: Stefan Neufeind
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
t3lib/class.t3lib_div.php

index 73a6074..10d4431 100644 (file)
@@ -4889,10 +4889,24 @@ final class t3lib_div {
                if (!is_array($excludeServiceKeys)) {
                        $excludeServiceKeys = self::trimExplode(',', $excludeServiceKeys, 1);
                }
+
+               $requestInfo = array(
+                       'requestedServiceType' => $serviceType,
+                       'requestedServiceSubType' => $serviceSubType,
+                       'requestedExcludeServiceKeys' => $excludeServiceKeys,
+               );
+
                while ($info = t3lib_extMgm::findService($serviceType, $serviceSubType, $excludeServiceKeys)) {
 
+                               // provide information about requested service to service object
+                       $info = array_merge($info, $requestInfo);
+
                                // Check persistent object and if found, call directly and exit.
                        if (is_object($GLOBALS['T3_VAR']['makeInstanceService'][$info['className']])) {
+
+                                       // update request info in persistent object
+                               $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]->info = $info;
+
                                        // reset service and return object
                                $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']]->reset();
                                return $GLOBALS['T3_VAR']['makeInstanceService'][$info['className']];