public function ConfigCacheTag::onSave in Real Name 2.x
Same name and namespace in other branches
- 8 src/EventSubscriber/ConfigCacheTag.php \Drupal\realname\EventSubscriber\ConfigCacheTag::onSave()
Invalidate cache tags when particular realname config objects are saved.
Parameters
\Drupal\Core\Config\ConfigCrudEvent $event: The Event to process.
File
- src/
EventSubscriber/ ConfigCacheTag.php, line 38
Class
- ConfigCacheTag
- A subscriber invalidating cache tags when realname config objects are saved.
Namespace
Drupal\realname\EventSubscriberCode
public function onSave(ConfigCrudEvent $event) {
// Check if realname settings object has been changed.
if ($event
->getConfig()
->getName() === 'realname.settings') {
// Clear the realname cache if the pattern was changed.
realname_delete_all();
// A change to the display-name pattern must invalidate the render cache
// since the display-name could be used anywhere.
$this->cacheTagsInvalidator
->invalidateTags([
'rendered',
]);
}
}