core/lib/Drupal/Core/Menu/MenuLinkDefault.php | 3 +-- core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php | 7 +++++++ core/lib/Drupal/Core/Menu/StaticMenuLinkOverridesInterface.php | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/core/lib/Drupal/Core/Menu/MenuLinkDefault.php b/core/lib/Drupal/Core/Menu/MenuLinkDefault.php index e118824..6b1d55c 100644 --- a/core/lib/Drupal/Core/Menu/MenuLinkDefault.php +++ b/core/lib/Drupal/Core/Menu/MenuLinkDefault.php @@ -95,8 +95,7 @@ public function getDescription() { */ public function isResettable() { // The link can be reset if it has an override. - // @todo This will be cacheable after https://www.drupal.org/node/2040135. - return AccessResult::allowedIf($this->staticOverride->loadOverride($this->getPluginId()))->setCacheable(FALSE); + return AccessResult::allowedIf($this->staticOverride->loadOverride($this->getPluginId()))->cacheUntilConfigurationChanges($this->staticOverride->getCacheTags()); } /** diff --git a/core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php b/core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php index ebde906..3f30dfc 100644 --- a/core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php +++ b/core/lib/Drupal/Core/Menu/StaticMenuLinkOverrides.php @@ -144,6 +144,13 @@ public function saveOverride($id, array $definition) { } /** + * {@inheritdoc} + */ + public function getCacheTags() { + return $this->getConfig()->getCacheTags(); + } + + /** * Encodes the ID by replacing dots with double underscores. * * This is done because config schema uses dots for its internal type diff --git a/core/lib/Drupal/Core/Menu/StaticMenuLinkOverridesInterface.php b/core/lib/Drupal/Core/Menu/StaticMenuLinkOverridesInterface.php index 43c4416..f3f429a 100644 --- a/core/lib/Drupal/Core/Menu/StaticMenuLinkOverridesInterface.php +++ b/core/lib/Drupal/Core/Menu/StaticMenuLinkOverridesInterface.php @@ -84,4 +84,12 @@ public function loadMultipleOverrides(array $ids); */ public function saveOverride($id, array $definition); + /** + * The unique cache tag associated with this menu link override. + * + * @return string[] + * An array of cache tags. + */ + public function getCacheTags(); + }