D7_LOAD_HOOKS
D7_LOAD_HOOKS = ['entity', 'node', 'user', 'comment', 'taxonomy_term', 'taxonomy_vocabulary', 'file']
The entity types Drupal 7 called a `hook_TYPE_load()` for.
The module handler, with the alters whose Drupal 7 and Drupal 11 arguments differ.
Only menu_local_tasks and system_info are routed away and element_info gets stubs for the
Drupal 7 types Drupal 11 lacks; every other alter is core's. Entity load and access hooks of types
Drupal 7 had no such hook for skip procedural functions that only share the name, and the
results of an access hook are read as Drupal 11 access results.
alter(string|string[] $type, mixed $data, mixed $context1 = null, mixed $context2 = null) : mixed
Alters data, giving legacy local task implementations the Drupal 7 arguments.
| string|string[] | $type | The alter type. |
| mixed | $data | The data to alter. |
| mixed | $context1 | The first context argument. |
| mixed | $context2 | The second context argument. |
invokeAllWith(string $hook, callable $callback) : void
Invokes a hook, skipping procedural functions that only share its name.
Drupal 11 calls MODULE_TYPE_load($entities) for every entity type, config ones included.
A Drupal 7 module can own a function by that name for another reason (Features'
features_filter_format_load($name) is a loader helper), and calling it with an array of
entities is a fatal. Drupal 7 had a load hook for the types in D7_LOAD_HOOKS only, so a
procedural implementation of any other type's hook is skipped and recorded.
| string | $hook | The hook name. |
| callable | $callback | Receives each implementation and its module. |
invokeAll(string $hook, array$args = []) : mixed
Invokes a hook and reads the results of an access hook as access results.
Drupal 7's hook_node_access() answered allow, deny or ignore strings, and a Drupal 11
caller combines the results with orIf(), which fatals on anything else. The strings map to
allowed, forbidden and neutral. Any other value is no opinion, and is recorded.
| string | $hook | The hook name. |
| array |
$args | The arguments. |
guardAccessListener(string $hook, mixed $listener) : mixed
Wraps a procedural access implementation that needs more arguments than the hook passes.
Drupal 11 calls MODULE_entity_access($entity, $operation, $account) for every module. A
Drupal 7 module can own a helper by that name with another signature (Search API's takes
none and answers a boolean), which is called and read as no opinion. One that requires more
arguments than the hook has would be an ArgumentCountError, so it is skipped and recorded.
| string | $hook | |
| mixed | $listener |