class AHooks
Provides hook implementations for testing the execution order of hooks.
By default, these will be called in module order, which is predictable due to the alphabetical module names.
Two attributes are used to change the 'test_hook' implementations in module ccc_hook_order_test. One is the ReorderHook attribute which is used to put the \Drupal\ccc_hook_order_test\Hook\CHooks::testHookFirst() first. The other is RemoveHook which is used to remove \Drupal\ccc_hook_order_test\Hook\CHooks::testHookRemoved(). Both of those attributes are declared in \Drupal\ddd_hook_order_test\Hook\DHooks.
Hierarchy
- class \Drupal\aaa_hook_order_test\Hook\AHooks
Expanded class hierarchy of AHooks
See also
\Drupal\KernelTests\Core\Hook\HookOrderTest::testHookOrder()
\Drupal\KernelTests\Core\Hook\HookOrderTest::testBothParametersHookOrder()
1 file declares its use of AHooks
- HookOrderTest.php in core/
tests/ Drupal/ KernelTests/ Core/ Hook/ HookOrderTest.php
File
-
core/
modules/ system/ tests/ modules/ HookOrder/ aaa_hook_order_test/ src/ Hook/ AHooks.php, line 31
Namespace
Drupal\aaa_hook_order_test\HookView source
class AHooks {
/**
* Implements hook_test_hook().
*
* This implementation has no ordering modifications.
*/
public function testHook() : string {
return __METHOD__;
}
/**
* Implements hook_test_hook().
*
* This implementation changes its order to be first.
*/
public function testHookFirst() : string {
return __METHOD__;
}
/**
* Implements hook_test_hook().
*
* This implementation changes its order to be last.
*/
public function testHookLast() : string {
return __METHOD__;
}
/**
* Implements hook_test_hook().
*
* This implementation changes its order to be after the hooks in module
* bbb_hook_order_test.
*/
public function testHookAfterB() : string {
return __METHOD__;
}
/**
* Implements test_both_parameters_hook().
*
* This implementation changes its order to be after the hooks in module
* bbb_hook_order_test and
* \Drupal\ccc_hook_order_test\Hook\CHooks::testBothParametersHook().)
*/
public function testBothParametersHook() : string {
return __METHOD__;
}
/**
* Implements test_procedural_reorder().
*/
public function testProceduralReorder() : string {
return __METHOD__;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| AHooks::testBothParametersHook | public | function | Implements test_both_parameters_hook(). |
| AHooks::testHook | public | function | Implements hook_test_hook(). |
| AHooks::testHookAfterB | public | function | Implements hook_test_hook(). |
| AHooks::testHookFirst | public | function | Implements hook_test_hook(). |
| AHooks::testHookLast | public | function | Implements hook_test_hook(). |
| AHooks::testProceduralReorder | public | function | Implements test_procedural_reorder(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.