class ParagraphsCollectionStyleConfigCacheTag in Paragraphs Collection 8
Invalidates the 'rendered' cache tag when saving paragraphs_collection.settings.
Hierarchy
- class \Drupal\paragraphs_collection\EventSubscriber\ParagraphsCollectionStyleConfigCacheTag implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of ParagraphsCollectionStyleConfigCacheTag
1 string reference to 'ParagraphsCollectionStyleConfigCacheTag'
1 service uses ParagraphsCollectionStyleConfigCacheTag
File
- src/
EventSubscriber/ ParagraphsCollectionStyleConfigCacheTag.php, line 14
Namespace
Drupal\paragraphs_collection\EventSubscriberView source
class ParagraphsCollectionStyleConfigCacheTag implements EventSubscriberInterface {
/**
* The cache tags invalidator.
*
* @var \Drupal\Core\Cache\CacheTagsInvalidatorInterface
*/
protected $cacheTagsInvalidator;
/**
* Constructs a ParagraphsCollectionSettingsCacheTag object.
*
* @param \Drupal\Core\Cache\CacheTagsInvalidatorInterface $cache_tags_invalidator
* The cache tags invalidator.
*/
public function __construct(CacheTagsInvalidatorInterface $cache_tags_invalidator) {
$this->cacheTagsInvalidator = $cache_tags_invalidator;
}
/**
* Invalidate the 'rendered' cache tag whenever the settings are modified.
*
* @param \Drupal\Core\Config\ConfigCrudEvent $event
* The Event to process.
*/
public function onSave(ConfigCrudEvent $event) {
if ($event
->getConfig()
->getName() === 'paragraphs_collection.settings') {
// Invalidate caches.
$this->cacheTagsInvalidator
->invalidateTags([
'rendered',
]);
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[ConfigEvents::SAVE][] = [
'onSave',
];
return $events;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ParagraphsCollectionStyleConfigCacheTag:: |
protected | property | The cache tags invalidator. | |
ParagraphsCollectionStyleConfigCacheTag:: |
public static | function | ||
ParagraphsCollectionStyleConfigCacheTag:: |
public | function | Invalidate the 'rendered' cache tag whenever the settings are modified. | |
ParagraphsCollectionStyleConfigCacheTag:: |
public | function | Constructs a ParagraphsCollectionSettingsCacheTag object. |