[TYPO3-shop] Hook for own markers

Tapio Markula tapio.markula at atwebteam.com
Thu Mar 29 14:30:12 CEST 2007


Franz Holzinger kirjoitti:
> Hello Tapio,
> 
>> how the hook could actually change the array $markerArray?
>>
>> Should it be rather
>> if (method_exists($hookObj, 'addGlobalMarkers')) {
>>                 $markerArray=$hookObj->addGlobalMarkers($markerArray);
>>          }
>>
>> and in the end is
>> return $markerArray;
>> that returns changed $markerArray.
> 
> I do not want to pass the maybe big array as a return parameter.
> 
> Use it like
> 
> class myGlobalMarkerHookClass {
> 
> function addGlobalMarkers(&$markerArray)	 {
> 
>     $markerArray['###MY_MARKER###'] = 'this is my marker';
> 
>     return;
> }
> }


I tried but that didn't work. I must put

     // Call all addGlobalMarkers hooks at the end of this method
		if (is_array 
($TYPO3_CONF_VARS['EXTCONF'][TT_PRODUCTS_EXTkey]['addGlobalMarkers'])) {
		    foreach 
($TYPO3_CONF_VARS['EXTCONF'][TT_PRODUCTS_EXTkey]['addGlobalMarkers'] as 
$classRef) {
			$hookObj= &t3lib_div::getUserObj($classRef);
			if (method_exists($hookObj, 'addGlobalMarkers')) {
			    $markerArray = 
array_merge($hookObj->addGlobalMarkers($markerArray),$markerArray);
			}
		    }
		}


More information about the TYPO3-project-tt-products mailing list