function EntityTestHooks::recordHooks

Helper function to be used to record hook invocations.

Parameters

string $hook: The hook name.

mixed $data: Arbitrary data associated with the hook invocation.

20 calls to EntityTestHooks::recordHooks()
EntityTestHooks::entityRevisionCreate in core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php
Implements hook_entity_revision_create().
EntityTestHooks::entityTestMulChangedTranslationCreate in core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php
Implements hook_ENTITY_TYPE_translation_create() for 'entity_test_mul_changed'.
EntityTestHooks::entityTestMulChangedTranslationDelete in core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php
Implements hook_ENTITY_TYPE_translation_delete().
EntityTestHooks::entityTestMulChangedTranslationInsert in core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php
Implements hook_ENTITY_TYPE_translation_insert() for 'entity_test_mul_changed'.
EntityTestHooks::entityTestMulLangcodeKeyTranslationCreate in core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php
Implements hook_ENTITY_TYPE_translation_create() for 'entity_test_mul_langcode_key'.

... See full list

File

core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php, line 738

Class

EntityTestHooks
Hook implementations for entity_test.

Namespace

Drupal\entity_test\Hook

Code

protected function recordHooks($hook, $data) : void {
    $state = \Drupal::state();
    $key = 'entity_test.hooks';
    $hooks = $state->get($key);
    $hooks[$hook] = $data;
    $state->set($key, $hooks);
}

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