function HookDiscovery::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php \Drupal\Core\Plugin\Discovery\HookDiscovery::__construct()
  2. 8.9.x core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php \Drupal\Core\Plugin\Discovery\HookDiscovery::__construct()
  3. 10 core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php \Drupal\Core\Plugin\Discovery\HookDiscovery::__construct()

Constructs a Drupal\Core\Plugin\Discovery\HookDiscovery object.

Parameters

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.

string $hook: The Drupal hook that a module can implement in order to interface to this discovery class.

File

core/lib/Drupal/Core/Plugin/Discovery/HookDiscovery.php, line 39

Class

HookDiscovery
Provides a hook-based plugin discovery class.

Namespace

Drupal\Core\Plugin\Discovery

Code

public function __construct(ModuleHandlerInterface $module_handler, $hook) {
    $this->moduleHandler = $module_handler;
    $this->hook = $hook;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.