public function PathautoSettingsCacheTag::onSave in Pathauto 8
Invalidate the 'rendered' cache tag whenever the settings are modified.
Parameters
\Drupal\Core\Config\ConfigCrudEvent $event: The Event to process.
File
- src/
EventSubscriber/ PathautoSettingsCacheTag.php, line 47
Class
- PathautoSettingsCacheTag
- A subscriber to clear fielddefinition cache when saving pathauto settings.
Namespace
Drupal\pathauto\EventSubscriberCode
public function onSave(ConfigCrudEvent $event) {
if ($event
->getConfig()
->getName() === 'pathauto.settings') {
$config = $event
->getConfig();
$original_entity_types = $config
->getOriginal('enabled_entity_types');
// Clear cached field definitions if the values are changed.
if ($original_entity_types != $config
->get('enabled_entity_types')) {
$this->entityFieldManager
->clearCachedFieldDefinitions();
$this->aliasTypeManager
->clearCachedDefinitions();
}
}
}