public function ConfigSubscriber::onSave in CDN 8.3
Invalidates all render caches when CDN settings are modified.
Parameters
\Drupal\Core\Config\ConfigCrudEvent $event: The Event to process.
File
- src/
EventSubscriber/ ConfigSubscriber.php, line 73
Class
- ConfigSubscriber
- Invalidates cache tags & rebuilds container when necessary.
Namespace
Drupal\cdn\EventSubscriberCode
public function onSave(ConfigCrudEvent $event) {
// Stream wrappers may be provided by contrib modules, e.g. Flysystem.
// In the case of modules, there is no API to determine and dynamically add
// the module dependency. If Drupal is installed from configuration, this
// could result in CDN rejecting the saved config which references a stream
// wrapper from a not-yet-installed module.
if ($this->configInstaller
->isSyncing()) {
return;
}
if ($event
->getConfig()
->getName() === 'cdn.settings') {
$this->cacheTagsInvalidator
->invalidateTags([
// Rendered output that is cached. (HTML containing URLs.)
'rendered',
]);
$this
->validate($event
->getConfig());
// Rebuild the container whenever the 'status' configuration changes.
// @see \Drupal\cdn\CdnServiceProvider
if ($event
->isChanged('status')) {
$this->drupalKernel
->invalidateContainer();
}
}
}