core/modules/tour/src/Entity/Tour.php | 14 -------------- core/modules/tour/src/Tests/TourCacheTagsTest.php | 4 ++-- core/modules/tour/src/TourInterface.php | 2 +- core/modules/tour/src/TourViewBuilder.php | 5 ++++- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/core/modules/tour/src/Entity/Tour.php b/core/modules/tour/src/Entity/Tour.php index 07010b1..55b94f1 100644 --- a/core/modules/tour/src/Entity/Tour.php +++ b/core/modules/tour/src/Entity/Tour.php @@ -169,18 +169,4 @@ public function calculateDependencies() { return $this->dependencies; } - /** - * {@inheritdoc} - */ - public function getCacheTag() { - return ['tour' => TRUE]; - } - - /** - * {@inheritdoc} - */ - public function getListCacheTags() { - return ['tour' => TRUE]; - } - } diff --git a/core/modules/tour/src/Tests/TourCacheTagsTest.php b/core/modules/tour/src/Tests/TourCacheTagsTest.php index 0a136df..c0c3cac 100644 --- a/core/modules/tour/src/Tests/TourCacheTagsTest.php +++ b/core/modules/tour/src/Tests/TourCacheTagsTest.php @@ -39,7 +39,7 @@ protected function setUp() { * Tests cache tags presence and invalidation of the Tour entity. * * Tests the following cache tags: - * - ['tour' => TRUE] + * - ['tour' => ''] */ public function testRenderedTour() { $path = 'tour-test-1'; @@ -51,7 +51,7 @@ public function testRenderedTour() { $expected_tags = array( 'theme:stark', 'theme_global_settings:1', - 'tour:1', + 'tour:tour-test', 'rendered:1', ); $this->verifyPageCache($path, 'HIT', $expected_tags); diff --git a/core/modules/tour/src/TourInterface.php b/core/modules/tour/src/TourInterface.php index 2aa1459..ba0593f 100644 --- a/core/modules/tour/src/TourInterface.php +++ b/core/modules/tour/src/TourInterface.php @@ -2,7 +2,7 @@ /** * @file - * Contains \Drupal\tour\Entity\TourInterface. + * Contains \Drupal\tour\TourInterface. */ namespace Drupal\tour; diff --git a/core/modules/tour/src/TourViewBuilder.php b/core/modules/tour/src/TourViewBuilder.php index 56c7dfe..6f2fa27 100644 --- a/core/modules/tour/src/TourViewBuilder.php +++ b/core/modules/tour/src/TourViewBuilder.php @@ -19,6 +19,7 @@ class TourViewBuilder extends EntityViewBuilder { * {@inheritdoc} */ public function viewMultiple(array $entities = array(), $view_mode = 'full', $langcode = NULL) { + /** @var \Drupal\tour\TourInterface[] $entities */ $build = array(); foreach ($entities as $entity_id => $entity) { $tips = $entity->getTips(); @@ -63,13 +64,15 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la 'hidden', ), ), + '#cache' => [ + 'tags' => $entity->getCacheTag(), + ], ); } } // If at least one tour was built, attach the tour library. if ($build) { $build['#attached']['library'][] = 'tour/tour'; - $build['#cache']['tags']['tour'] = TRUE; } return $build; }