diff --git a/core/lib/Drupal/Core/Access/AccessResult.php b/core/lib/Drupal/Core/Access/AccessResult.php index 9c4e42f..269c83b 100644 --- a/core/lib/Drupal/Core/Access/AccessResult.php +++ b/core/lib/Drupal/Core/Access/AccessResult.php @@ -25,6 +25,9 @@ * * When using ::orIf() and ::andIf(), cacheability metadata will be merged * accordingly as well. + * + * @todo Use MutableCacheableDependencyInterface and the corresponding trait in + * https://www.drupal.org/node/2526326. */ abstract class AccessResult implements AccessResultInterface, CacheableDependencyInterface { diff --git a/core/lib/Drupal/Core/Cache/CacheableMetadata.php b/core/lib/Drupal/Core/Cache/CacheableMetadata.php index a0c1ba8..e0bb6ac 100644 --- a/core/lib/Drupal/Core/Cache/CacheableMetadata.php +++ b/core/lib/Drupal/Core/Cache/CacheableMetadata.php @@ -10,6 +10,9 @@ * Defines a generic class for passing cacheability metadata. * * @ingroup cache + * + * @todo Use MutableCacheableDependencyInterface and the corresponding trait in + * https://www.drupal.org/node/2526326. */ class CacheableMetadata implements CacheableDependencyInterface { diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index c9f6502..e9432f7 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -409,7 +409,7 @@ public function link($text = NULL, $rel = 'edit-form', array $options = []) { /** * {@inheritdoc} */ - public function getCacheTags() { + public function getCacheTagsForInvalidation() { // Use cache tags that match the underlying config object's name. // @see \Drupal\Core\Config\ConfigBase::getCacheTags() return ['config:' . $this->getConfigDependencyName()]; diff --git a/core/lib/Drupal/Core/Datetime/Entity/DateFormat.php b/core/lib/Drupal/Core/Datetime/Entity/DateFormat.php index fa1de86..0561df1 100644 --- a/core/lib/Drupal/Core/Datetime/Entity/DateFormat.php +++ b/core/lib/Drupal/Core/Datetime/Entity/DateFormat.php @@ -101,7 +101,7 @@ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) /** * {@inheritdoc} */ - public function getCacheTags() { + public function getCacheTagsForInvalidation() { return ['rendered']; } diff --git a/core/lib/Drupal/Core/Entity/EntityForm.php b/core/lib/Drupal/Core/Entity/EntityForm.php index e5ededc..9caaf8d 100644 --- a/core/lib/Drupal/Core/Entity/EntityForm.php +++ b/core/lib/Drupal/Core/Entity/EntityForm.php @@ -101,8 +101,8 @@ public function buildForm(array $form, FormStateInterface $form_state) { $this->init($form_state); } - // Ensure that edit forms have the correct cacheability metadata so they can be - // cached. + // Ensure that edit forms have the correct cacheability metadata so they can + // be cached. if (!$this->entity->isNew()) { \Drupal::service('renderer')->addCacheableDependency($form, $this->entity); } diff --git a/core/lib/Drupal/Core/Entity/EntityInterface.php b/core/lib/Drupal/Core/Entity/EntityInterface.php index 308e16c..2e1a208 100644 --- a/core/lib/Drupal/Core/Entity/EntityInterface.php +++ b/core/lib/Drupal/Core/Entity/EntityInterface.php @@ -350,10 +350,18 @@ public function referencedEntities(); public function getOriginalId(); /** - * Returns the original cache tags of this entity, without mutations. + * Returns the cache tags that should be used when invalidating caches. + * + * This will not return additional cache tags added through addCacheTags(). + * Invalidating caches that are depending on this entity must use this + * method. * * @return string[] - * List of cache tags. + * Set of cache tags. + * + * @see \Drupal\Core\Cache\MutableCacheableDependencyInterface::addCacheTags() + * @see \Drupal\Core\Cache\CacheableDependencyInterface::getCacheTags() + * */ public function getCacheTagsForInvalidation(); diff --git a/core/modules/aggregator/src/Entity/Item.php b/core/modules/aggregator/src/Entity/Item.php index b3d4af1..44f4c15 100644 --- a/core/modules/aggregator/src/Entity/Item.php +++ b/core/modules/aggregator/src/Entity/Item.php @@ -231,7 +231,7 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) { /** * {@inheritdoc} */ - public function getCacheTags() { + public function getCacheTagsForInvalidation() { return Feed::load($this->getFeedId())->getCacheTags(); } diff --git a/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php b/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php index db04c49..5faa85c 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationUITestBase.php @@ -44,7 +44,7 @@ * * @var string[] */ - protected $defaultCacheContexts = ['languages:language_interface', 'theme' , 'user.permissions']; + protected $defaultCacheContexts = ['languages:language_interface', 'theme', 'user.permissions']; /** * Tests the basic translation UI. diff --git a/core/modules/menu_link_content/src/Tests/MenuLinkContentTranslationUITest.php b/core/modules/menu_link_content/src/Tests/MenuLinkContentTranslationUITest.php index 00604df..615da6b 100644 --- a/core/modules/menu_link_content/src/Tests/MenuLinkContentTranslationUITest.php +++ b/core/modules/menu_link_content/src/Tests/MenuLinkContentTranslationUITest.php @@ -20,7 +20,7 @@ class MenuLinkContentTranslationUITest extends ContentTranslationUITestBase { /** * {inheritdoc} */ - protected $defaultCacheContexts = ['languages:language_interface', 'theme' , 'user.permissions', 'user.roles:authenticated']; + protected $defaultCacheContexts = ['languages:language_interface', 'theme', 'user.permissions', 'user.roles:authenticated']; /** * Modules to enable. diff --git a/core/modules/shortcut/src/Entity/Shortcut.php b/core/modules/shortcut/src/Entity/Shortcut.php index abdc9c5..29a18f4 100644 --- a/core/modules/shortcut/src/Entity/Shortcut.php +++ b/core/modules/shortcut/src/Entity/Shortcut.php @@ -178,7 +178,7 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { /** * {@inheritdoc} */ - public function getCacheTags() { + public function getCacheTagsForInvalidation() { return $this->shortcut_set->entity->getCacheTags(); } diff --git a/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php b/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php index 580e934..e324d80 100644 --- a/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php +++ b/core/modules/shortcut/src/Tests/ShortcutTranslationUITest.php @@ -21,7 +21,7 @@ class ShortcutTranslationUITest extends ContentTranslationUITestBase { /** * {inheritdoc} */ - protected $defaultCacheContexts = ['languages:language_interface', 'theme' , 'user']; + protected $defaultCacheContexts = ['languages:language_interface', 'theme', 'user']; /** * Modules to enable.