Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ModuleHandler.php

function ModuleHandler::invoke

Overrides ModuleHandlerInterface::invoke

1 call to ModuleHandler::invoke()
ModuleHandler::invokeDeprecated in core/lib/Drupal/Core/Extension/ModuleHandler.php
Invokes a deprecated hook in a particular module.

File

core/lib/Drupal/Core/Extension/ModuleHandler.php, line 315

Class

ModuleHandler
Class that manages modules in a Drupal installation.

Namespace

Drupal\Core\Extension

Code

public function invoke($module, $hook, array $args = []) {
    if ($listeners = $this->getHookListeners($hook)[$module] ?? []) {
        if (count($listeners) > 1) {
            throw new \LogicException("Module {$module} should not implement {$hook} more than once");
        }
        return reset($listeners)(...$args);
    }
    return $this->legacyInvoke($module, $hook, $args);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal