function Fast404ExceptionHtmlSubscriber::onConfigSave

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php \Drupal\Core\EventSubscriber\Fast404ExceptionHtmlSubscriber::onConfigSave()
  2. 11.x core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php \Drupal\Core\EventSubscriber\Fast404ExceptionHtmlSubscriber::onConfigSave()

Invalidates 4xx-response cache tag if fast 404 config is changed.

Parameters

\Drupal\Core\Config\ConfigCrudEvent $event: The configuration event.

File

core/lib/Drupal/Core/EventSubscriber/Fast404ExceptionHtmlSubscriber.php, line 114

Class

Fast404ExceptionHtmlSubscriber
High-performance 404 exception subscriber.

Namespace

Drupal\Core\EventSubscriber

Code

public function onConfigSave(ConfigCrudEvent $event) : void {
  $saved_config = $event->getConfig();
  if ($saved_config->getName() === 'system.performance' && $event->isChanged('fast_404')) {
    $this->cacheTagsInvalidator
      ->invalidateTags([
      '4xx-response',
    ]);
  }
}

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