public function CachedModuleHandler::getHookInfo

Overrides \Drupal\Core\Extension\ModuleHandler::getHookInfo().

Overrides ModuleHandler::getHookInfo

File

drupal/core/lib/Drupal/Core/Extension/CachedModuleHandler.php, line 69
Contains Drupal\Core\Extension\CachedModuleHandler.

Class

CachedModuleHandler
Class that manages enabled modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

public function getHookInfo() {

  // When this function is indirectly invoked from bootstrap_invoke_all() prior
  // to all modules being loaded, we do not want to cache an incomplete
  // hook_hookInfo() result, so instead return an empty array. This requires
  // bootstrap hook implementations to reside in the .module file, which is
  // optimal for performance anyway.
  if (!$this->loaded) {
    return array();
  }
  if (!isset($this->hookInfo)) {
    if ($cache = $this->bootstrapCache
      ->get('hook_info')) {
      $this->hookInfo = $cache->data;
    }
    else {
      $this->hookInfo = parent::getHookInfo();
      $this->bootstrapCache
        ->set('hook_info', $this->hookInfo);
    }
  }
  return $this->hookInfo;
}