Invalidates the 'rendered' cache tag when saving paragraphs_collection.settings.
Expanded class hierarchy of ParagraphsCollectionStyleConfigCacheTag
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;
}
}
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. |