function ColorConfigCacheInvalidator::onChange

Same name and namespace in other branches
  1. 9 core/modules/color/src/EventSubscriber/ColorConfigCacheInvalidator.php \Drupal\color\EventSubscriber\ColorConfigCacheInvalidator::onChange()

Invalidate cache tags when a color theme config object changes.

Parameters

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

File

core/modules/color/src/EventSubscriber/ColorConfigCacheInvalidator.php, line 38

Class

ColorConfigCacheInvalidator
A subscriber invalidating cache tags when color config objects are saved.

Namespace

Drupal\color\EventSubscriber

Code

public function onChange(ConfigCrudEvent $event) {
    // Changing a theme's color settings causes the theme's asset library
    // containing the color CSS file to be altered to use a different file.
    if (strpos($event->getConfig()
        ->getName(), 'color.theme.') === 0) {
        $this->cacheTagsInvalidator
            ->invalidateTags([
            'library_info',
        ]);
    }
}

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