function TaxonomyTestHooks::taxonomyTermLoad

Implements hook_ENTITY_TYPE_load() for the taxonomy term.

Attributes

#[Hook('taxonomy_term_load')]

File

core/modules/taxonomy/tests/modules/taxonomy_test/src/Hook/TaxonomyTestHooks.php, line 81

Class

TaxonomyTestHooks
Hook implementations for taxonomy_test.

Namespace

Drupal\taxonomy_test\Hook

Code

public function taxonomyTermLoad($entities) : void {
  $value = \Drupal::state()->get('taxonomy_test_taxonomy_term_load');
  // Only record loaded terms is the test has set this to an empty array.
  if (is_array($value)) {
    $value = array_merge($value, array_keys($entities));
    \Drupal::state()->set('taxonomy_test_taxonomy_term_load', array_unique($value));
  }
}

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