[TYPO3-mvc] Alternative to hooks

Xavier Perseguers typo3 at perseguers.ch
Wed Jan 5 15:18:40 CET 2011


Hi,

> Beside having function names in a string with filenames you could use a
> another approach that is used by tt_news too.
>
> if
> (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_news']['extraItemMarkerHook']))
> {
> foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_news']['extraItemMarkerHook']
> as $_classRef) {
> $_procObj = & t3lib_div::getUserObj($_classRef);
> if (method_exists($_procObj, 'extraItemMarkerProcessor')) {
> $markerArray = $_procObj->extraItemMarkerProcessor($markerArray, $row,
> $lConf, $this);
> }
> }
> }
>
> By this you only register the class and in the hook a certain method
> needs be implemented. This way you have no combination of function and
> filename.

You then better have to implement some interface. Recent code in t3lib 
is using this approach.

Xavier


More information about the TYPO3-project-typo3v4mvc mailing list