Feature #27956

Integrate hook dispatcher

Added by Oliver Hader over 8 years ago. Updated about 2 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Miscellaneous
Target version:
-
Start date:
2011-07-07
Due date:
% Done:

0%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Integrate a hook dispatcher that checks for accordant hooks and dispatches them.
Besides that the hook dispatcher knows about deprecated or outdated hooks, e.g.
$TYPO3_CONF_VARS['SC_OPTIONS']['tslib/index_ts.php']['preBeUser'] which will be located in class.tslib_fe.php in the future.


Related issues

Related to TYPO3 Core - Bug #27917: Bootstap - Frontend: The Backend User Initialization should be encapsulated Closed 2011-07-06

History

#1 Updated by Tolleiv Nietsch over 8 years ago

1st brainstorming stuff:


t3lib_utility_HookDispatcher::executeFunction($name, $this, $params)

    // Call hook when a page is retrieved from cache:
if (is_array($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageLoadedFromCache']))    {
    $_params = array('pObj' => &$this, 'cache_pages_row' => &$row);
    foreach($this->TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_fe.php']['pageLoadedFromCache'] as $_funcRef)    {
        t3lib_div::callUserFunction($_funcRef,$_params,$this);
    }
}

// possibility to use closures here 

t3lib_utility_HookDispatcher::executeInterface($name, $this, $interface, $param1, $param2,$..., $timestamp)

if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['getData'])) {
    foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['getData'] as $classData) {
        $hookObject = t3lib_div::getUserObj($classData);

        if (!($hookObject instanceof tslib_content_getDataHook)) {
            throw new UnexpectedValueException('$hookObject must implement interface tslib_content_getDataHook', 1195044480);
        }

        $retVal = $hookObject->getDataExtension($string, $fieldArray, $secVal, $retVal, $this);
    }
}

t3lib_utility_HookDispatcher::executeObject($name, $this, $method, $param1, $param2,$...)

if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'] as $classRef) {
    $hookObjectsArr[] = t3lib_div::getUserObj($classRef);
}
}
foreach ($hookObjectsArr as $hookObj) {
    if (method_exists($hookObj, 'processDatamap_afterDatabaseOperations')) {
        $hookObj->processDatamap_afterDatabaseOperations($status, $table, $id, $fieldArray, $this);
    }
}

#2 Updated by Xavier Perseguers over 8 years ago

  • Target version deleted (4.6.0-beta1)

#3 Updated by Alexander Opitz almost 5 years ago

  • Status changed from New to Needs Feedback

Hi Oliver,

is this needed anymore after switching to signals?

#4 Updated by Gerrit Code Review over 3 years ago

  • Status changed from Needs Feedback to Under Review

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46338

#5 Updated by Susanne Moog about 2 years ago

  • Status changed from Under Review to Rejected

Also available in: Atom PDF