class ModuleImplementsAlter
Contains a replaceable callback for hook_module_implements_alter().
Hierarchy
- class \Drupal\aaa_hook_order_test\Hook\ModuleImplementsAlter
Expanded class hierarchy of ModuleImplementsAlter
2 files declare their use of ModuleImplementsAlter
- aaa_hook_order_test.module in core/
modules/ system/ tests/ modules/ HookOrder/ aaa_hook_order_test/ aaa_hook_order_test.module - HookAlterOrderTest.php in core/
tests/ Drupal/ KernelTests/ Core/ Hook/ HookAlterOrderTest.php
File
-
core/
modules/ system/ tests/ modules/ HookOrder/ aaa_hook_order_test/ src/ Hook/ ModuleImplementsAlter.php, line 10
Namespace
Drupal\aaa_hook_order_test\HookView source
class ModuleImplementsAlter {
/**
* Callback for hook_module_implements_alter().
*
* @var ?\Closure
* @phpstan-var (\Closure(array<string, string|false>&, string): void)|null
*/
private static ?\Closure $callback = NULL;
/**
* Sets a callback for hook_module_implements_alter().
*
* @param ?\Closure $callback
* Callback to set, or NULL to unset.
*
* @phpstan-param (\Closure(array<string, string|false>&, string): void)|null $callback
*/
public static function set(?\Closure $callback) : void {
self::$callback = $callback;
}
/**
* Invokes the registered callback.
*
* @param array<string, string|false> $implementations
* The implementations, as "group" by module name.
* @param string $hook
* The hook.
*/
public static function call(array &$implementations, string $hook) : void {
if (self::$callback === NULL) {
return;
}
(self::$callback)($implementations, $hook);
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ModuleImplementsAlter::$callback | private static | property | Callback for hook_module_implements_alter(). |
ModuleImplementsAlter::call | public static | function | Invokes the registered callback. |
ModuleImplementsAlter::set | public static | function | Sets a callback for hook_module_implements_alter(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.