moduleHandler = $module_handler; $this->hook = $hook; } /** * Implements Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions(). */ public function getDefinitions() { $definitions = array(); foreach ($this->moduleHandler->getImplementations($this->hook) as $module) { $result = $this->moduleHandler->invoke($module, $this->hook); foreach ($result as $plugin_id => $definition) { $definition['module'] = $module; $definitions[$plugin_id] = $definition; } } return $definitions; } }