core-modules/event-manager/src/EventManager.php
public function applyChain($name, $hookArg = null)
    {
        $hooks = $this->app->getHooks();

        if (!isset($hooks[$name])) {
            $hooks[$name] = array(array());
        }
        if (!empty($hooks[$name])) {
            // Sort by priority, low to high, if there's more than one priority
            if (count($hooks[$name]) > 1) {
                ksort($hooks[$name]);
            }
            foreach ($hooks[$name] as $priority) {
                if (!empty($priority)) {
                    foreach ($priority as $callable) {
                        $value = call_user_func($callable, $hookArg);
                        if ($value !== null) {
                            return $value;
                        }
                    }
                }
            }
        }
    }
public function applyChain($name, $hookArg = null)
    {
        $hooks = $this->app->getHooks();

        if (!isset($hooks[$name])) {
            $hooks[$name] = array(array());
        }
        if (!empty($hooks[$name])) {
            // Sort by priority, low to high, if there's more than one priority
            if (count($hooks[$name]) > 1) {
                ksort($hooks[$name]);
            }
            foreach ($hooks[$name] as $priority) {
                if (!empty($priority)) {
                    foreach ($priority as $callable) {
                        $value = call_user_func($callable, $hookArg);
                        if ($value !== null) {
                            return $value;
                        }
                    }
                }
            }
        }
    }
public function applyChain ( $ name , $ hookArg = null ) { $ hooks = $ this -> app -> getHooks ( ) ; if ( ! isset ( $ hooks [ $ name ] ) ) { $ hooks [ $ name ] = array ( array ( ) ) ; } if ( ! empty ( $ hooks [ $ name ] ) ) { // Sort by priority, low to high, if there's more than one priority if ( count ( $ hooks [ $ name ] ) > 1 ) { ksort ( $ hooks [ $ name ] ) ; } foreach ( $ hooks [ $ name ] as $ priority ) { if ( ! empty ( $ priority ) ) { foreach ( $ priority as $ callable ) { $ value = call_user_func ( $ callable , $ hookArg ) ; if ( $ value !== null ) { return $ value ; } } } } } }
Trigger a chained hook
- The first callback to return a non-null value
will be returned

@param  string     $name    the hook name
@param  mixed      $hookArg (Optional) Argument for hooked functions
@return mixed|void
Trigger a chained hook - The first callback to return a non - null value will be returned