function delay_cache_tags_invalidation_user_insert
Same name in other branches
- 8.9.x core/modules/system/tests/modules/delay_cache_tags_invalidation/delay_cache_tags_invalidation.module \delay_cache_tags_invalidation_user_insert()
- 10 core/modules/system/tests/modules/delay_cache_tags_invalidation/delay_cache_tags_invalidation.module \delay_cache_tags_invalidation_user_insert()
- 11.x core/modules/system/tests/modules/delay_cache_tags_invalidation/delay_cache_tags_invalidation.module \delay_cache_tags_invalidation_user_insert()
Implements hook_ENTITY_TYPE_insert().
File
-
core/
modules/ system/ tests/ modules/ delay_cache_tags_invalidation/ delay_cache_tags_invalidation.module, line 40
Code
function delay_cache_tags_invalidation_user_insert(UserInterface $entity) {
if ($entity->getAccountName() === 'johndoe') {
// Read the in-transaction cache writes.
// @see delay_cache_tags_invalidation_entity_test_insert()
\Drupal::state()->set(__FUNCTION__ . '__during_transaction_foobar', \Drupal::cache()->get('delay_cache_tags_invalidation_entity_test_insert__during_transaction_foobar'));
\Drupal::state()->set(__FUNCTION__ . '__during_transaction_entity_test_list', \Drupal::cache()->get('delay_cache_tags_invalidation_entity_test_insert__during_transaction_entity_test_list'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.