function ConfigEntityStaticCacheTestHooks::configTestLoad

Implements hook_ENTITY_TYPE_load() for 'static_cache_test_config_test'.

Attributes

#[Hook('config_test_load')]

File

core/modules/config/tests/config_entity_static_cache_test/src/Hook/ConfigEntityStaticCacheTestHooks.php, line 18

Class

ConfigEntityStaticCacheTestHooks
Hook implementations for config_entity_static_cache_test.

Namespace

Drupal\config_entity_static_cache_test\Hook

Code

public function configTestLoad($entities) : void {
  static $random;
  if (!$random) {
    $random = new Random();
  }
  foreach ($entities as $entity) {
    // Add a random stamp for every load(), so that during tests, we can tell
    // if an entity was retrieved from cache (unchanged stamp) or reloaded.
    $entity->_loadStamp = $random->string(8, TRUE);
  }
}

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