function ModuleHandlerInterface::invokeAllWith

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php \Drupal\Core\Extension\ModuleHandlerInterface::invokeAllWith()
  2. 10 core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php \Drupal\Core\Extension\ModuleHandlerInterface::invokeAllWith()

Executes a callback for each implementation of a hook.

The callback is passed two arguments, a closure which executes a hook implementation. And the module name.

Parameters

string $hook: The name of the hook to invoke.

callable $callback: A callable that invokes a hook implementation. Such that $callback is callable(callable, string): mixed. Arguments:

  • Closure to a hook implementation.
  • Implementation module machine name.
1 method overrides ModuleHandlerInterface::invokeAllWith()
ModuleHandler::invokeAllWith in core/lib/Drupal/Core/Extension/ModuleHandler.php

File

core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php, line 227

Class

ModuleHandlerInterface
Interface for classes that manage a set of enabled modules.

Namespace

Drupal\Core\Extension

Code

public function invokeAllWith(string $hook, callable $callback) : void;

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