You are here

public function ModuleHandler::implementsHook in Service Container 7.2

Same name and namespace in other branches
  1. 7 src/Extension/ModuleHandler.php \Drupal\service_container\Extension\ModuleHandler::implementsHook()

Returns whether a given module implements a given hook.

Parameters

string $module: The name of the module (without the .module extension).

string $hook: The name of the hook (e.g. "help" or "menu").

Return value

bool TRUE if the module is both installed and enabled, and the hook is implemented in that module.

Overrides ModuleHandlerInterface::implementsHook

File

src/Extension/ModuleHandler.php, line 191
Contains Drupal\service_container\Extension\ModuleHandler.

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\service_container\Extension

Code

public function implementsHook($module, $hook) {
  $implementations = $this->drupal7
    ->module_implements($hook);
  return in_array($module, $implementations);
}