Overrides \Drupal\Core\Extension\ModuleHandler::getImplementationInfo().
Overrides ModuleHandler::getImplementationInfo
protected function getImplementationInfo($hook) {
if (!isset($this->implementations)) {
$this->implementations = $this
->getCachedImplementationInfo();
}
if (!isset($this->implementations[$hook])) {
// The hook is not cached, so ensure that whether or not it has
// implementations, the cache is updated at the end of the request.
$this->cacheNeedsWriting = TRUE;
$this->implementations[$hook] = parent::getImplementationInfo($hook);
}
else {
foreach ($this->implementations[$hook] as $module => $group) {
// If this hook implementation is stored in a lazy-loaded file, include
// that file first.
if ($group) {
$this
->loadInclude($module, 'inc', "{$module}.{$group}");
}
// It is possible that a module removed a hook implementation without the
// implementations cache being rebuilt yet, so we check whether the
// function exists on each request to avoid undefined function errors.
// Since module_hook() may needlessly try to load the include file again,
// function_exists() is used directly here.
if (!function_exists($module . '_' . $hook)) {
// Clear out the stale implementation from the cache and force a cache
// refresh to forget about no longer existing hook implementations.
unset($this->implementations[$hook][$module]);
$this->cacheNeedsWriting = TRUE;
}
}
}
return $this->implementations[$hook];
}