You are here

public function ConfigCacheInvalidator::onSave in Sub-pathauto (Sub-path URL Aliases) 8

Invalidate the 'rendered' cache tag whenever the settings are modified.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: The Event to process.

File

src/EventSubscriber/ConfigCacheInvalidator.php, line 38

Class

ConfigCacheInvalidator
A subscriber invalidating cache tags when subpathauto config is saved.

Namespace

Drupal\subpathauto\EventSubscriber

Code

public function onSave(ConfigCrudEvent $event) {

  // Changing the Subpathauto settings means that any cached page might
  // result in a different response, so we need to invalidate them all.
  if ($event
    ->getConfig()
    ->getName() === 'subpathauto.settings') {
    $this->cacheTagsInvalidator
      ->invalidateTags([
      'rendered',
    ]);
  }
}