commit 58d816afb79057eb3005c0d1dff923bbb49f9736 Author: Joel Pittet Date: Thu Dec 3 09:55:47 2015 -0800 name change diff --git a/core/modules/color/color.services.yml b/core/modules/color/color.services.yml index 03f96e7..0505300 100644 --- a/core/modules/color/color.services.yml +++ b/core/modules/color/color.services.yml @@ -1,6 +1,6 @@ services: color.config_cache_tag: - class: Drupal\color\EventSubscriber\ConfigCacheTag + class: Drupal\color\EventSubscriber\ColorConfigCacheInvalidator arguments: ['@cache_tags.invalidator'] tags: - { name: event_subscriber } diff --git a/core/modules/color/src/EventSubscriber/ColorConfigCacheInvalidator.php b/core/modules/color/src/EventSubscriber/ColorConfigCacheInvalidator.php new file mode 100644 index 0000000..3af8d40 --- /dev/null +++ b/core/modules/color/src/EventSubscriber/ColorConfigCacheInvalidator.php @@ -0,0 +1,61 @@ +cacheTagsInvalidator = $cache_tags_invalidator; + } + + /** + * Invalidate cache tags when a color theme config object changes. + * + * @param \Drupal\Core\Config\ConfigCrudEvent $event + * The Event to process. + */ + 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']); + } + } + + /** + * {@inheritdoc} + */ + public static function getSubscribedEvents() { + $events[ConfigEvents::SAVE][] = ['onChange']; + $events[ConfigEvents::DELETE][] = ['onChange']; + + return $events; + } + +} diff --git a/core/modules/color/src/EventSubscriber/ConfigCacheTag.php b/core/modules/color/src/EventSubscriber/ConfigCacheTag.php deleted file mode 100644 index 2bddbb1..0000000 --- a/core/modules/color/src/EventSubscriber/ConfigCacheTag.php +++ /dev/null @@ -1,61 +0,0 @@ -cacheTagsInvalidator = $cache_tags_invalidator; - } - - /** - * Invalidate cache tags when a color theme config object changes. - * - * @param \Drupal\Core\Config\ConfigCrudEvent $event - * The Event to process. - */ - public function onChange(ConfigCrudEvent $event) { - // Changing the color theme settings may mean a different CSS or JavaScript - // library asset file. - if (strpos($event->getConfig()->getName(), 'color.theme.') === 0) { - $this->cacheTagsInvalidator->invalidateTags(['library_info']); - } - } - - /** - * {@inheritdoc} - */ - public static function getSubscribedEvents() { - $events[ConfigEvents::SAVE][] = ['onChange']; - $events[ConfigEvents::DELETE][] = ['onChange']; - - return $events; - } - -}