class CKEditor5CacheTag in Drupal 10
A subscriber invalidating cache tags when the default theme changes.
@internal This class may change at any time. It is not for use outside this module.
Hierarchy
- class \Drupal\ckeditor5\EventSubscriber\CKEditor5CacheTag implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of CKEditor5CacheTag
1 string reference to 'CKEditor5CacheTag'
- ckeditor5.services.yml in core/
modules/ ckeditor5/ ckeditor5.services.yml - core/modules/ckeditor5/ckeditor5.services.yml
1 service uses CKEditor5CacheTag
- ckeditor5.ckeditor5_cache_tag in core/
modules/ ckeditor5/ ckeditor5.services.yml - Drupal\ckeditor5\EventSubscriber\CKEditor5CacheTag
File
- core/
modules/ ckeditor5/ src/ EventSubscriber/ CKEditor5CacheTag.php, line 18
Namespace
Drupal\ckeditor5\EventSubscriberView source
class CKEditor5CacheTag implements EventSubscriberInterface {
/**
* The cache tags invalidator.
*
* @var \Drupal\Core\Cache\CacheTagsInvalidatorInterface
*/
protected $cacheTagsInvalidator;
/**
* Constructs a CKEditor5CacheTag 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;
}
/**
* Invalidates cache tags when particular system config objects are saved.
*
* @param \Drupal\Core\Config\ConfigCrudEvent $event
* The Event to process.
*/
public function onSave(ConfigCrudEvent $event) {
$config_name = $event
->getConfig()
->getName();
// Ckeditor5-stylesheets settings may change when the default theme changes.
if ($config_name === 'system.theme' && $event
->isChanged('default')) {
// @see ckeditor5_library_info_alter()
$this->cacheTagsInvalidator
->invalidateTags([
'library_info',
]);
}
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events[ConfigEvents::SAVE][] = [
'onSave',
];
return $events;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CKEditor5CacheTag:: |
protected | property | The cache tags invalidator. | |
CKEditor5CacheTag:: |
public static | function | ||
CKEditor5CacheTag:: |
public | function | Invalidates cache tags when particular system config objects are saved. | |
CKEditor5CacheTag:: |
public | function | Constructs a CKEditor5CacheTag object. |