class XyzMissingTargetAlter
This class contains attributes to reorder or remove alter implementations.
The idea behind the hook names:
- hook_test_ab_alter() has implementations in modules A and B.
- hook_test_b_alter() has implementations only in module B. As a consequence, it has no implementations if module B is not installed.
Hierarchy
- class \Drupal\xyz_hook_order_test\Hook\XyzMissingTargetAlter
Expanded class hierarchy of XyzMissingTargetAlter
See also
\Drupal\KernelTests\Core\Hook\HookAlterOrderTest::testReorderAlterMissingTarget()
File
-
core/
modules/ system/ tests/ modules/ HookOrder/ xyz_hook_order_test/ src/ Hook/ XyzMissingTargetAlter.php, line 23
Namespace
Drupal\xyz_hook_order_test\HookView source
class XyzMissingTargetAlter {
/**
* Hook order attributes that target possibly non-existing alter methods.
*
* (The targeted methods don't exist if module B is disabled.)
*/
public function targetABAlter() : void {
}
/**
* Hook order attributes that target a hook with possibly no implementations.
*
* (The target hook has no implementations if module B is disabled.)
*/
public function targetBAlter() : void {
}
/**
* Hook order attributes where the target method implements a different hook.
*
* This scenario is special for alter hooks, when the alter types for both
* hooks are passed to ->alter().
*/
public function targetASupertypeAlterForBSubtypeAlter() : void {
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| XyzMissingTargetAlter::targetABAlter | public | function | Hook order attributes that target possibly non-existing alter methods. |
| XyzMissingTargetAlter::targetASupertypeAlterForBSubtypeAlter | public | function | Hook order attributes where the target method implements a different hook. |
| XyzMissingTargetAlter::targetBAlter | public | function | Hook order attributes that target a hook with possibly no implementations. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.