function hook_hook_info

Same name in other branches
  1. 7.x modules/system/system.api.php \hook_hook_info()
  2. 9 core/lib/Drupal/Core/Extension/module.api.php \hook_hook_info()
  3. 8.9.x core/lib/Drupal/Core/Extension/module.api.php \hook_hook_info()
  4. 10 core/lib/Drupal/Core/Extension/module.api.php \hook_hook_info()

Defines one or more hooks that are exposed by a module.

Only procedural implementations are supported for this hook.

Support for this hook will be removed in Drupal 12.0.0. This hook has intentionally not been deprecated since removing implementations will break modules with code in $module.$group.inc files.

$module.$group.inc themselves have been deprecated, so modules supporting drupal 12.0.0 will have removed all code from $module.$group.inc files.

Once a module requires 12.0.0 as a minimum version of Drupal the module can safely remove hook_hook_info() implementations.

Return value

array An associative array whose keys are hook names and whose values are an associative array containing:

  • group: A string defining the group to which the hook belongs. The module system will determine whether a file with the name $module.$group.inc exists, and automatically load it when required.

Related topics

4 functions implement hook_hook_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

module_handler_test_hook_info in core/tests/Drupal/Tests/Core/Extension/modules/module_handler_test/module_handler_test.module
Implements hook_hook_info().
module_test_hook_info in core/modules/system/tests/modules/module_test/module_test.module
Implements hook_hook_info().
system_hook_info in core/modules/system/system.module
Implements hook_hook_info().
views_hook_info in core/modules/views/views.module
Implements hook_hook_info().

File

core/lib/Drupal/Core/Extension/module.api.php, line 84

Code

function hook_hook_info() : array {
    $hooks['token_info'] = [
        'group' => 'tokens',
    ];
    $hooks['tokens'] = [
        'group' => 'tokens',
    ];
    return $hooks;
}

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