core/lib/Drupal/Core/Entity/EntityViewBuilder.php | 2 +- .../Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index af5abe0..2c21668 100644 --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -189,7 +189,7 @@ protected function getBuildDefaults(EntityInterface $entity, $view_mode, $langco 'bin' => $this->cacheBin, ); - if ($entity instanceof TranslatableInterface && count($entity->getTranslationLanguages()) > 1) { + if ($entity instanceof TranslatableInterface && $entity->isTranslatable()) { $build['#cache']['keys'][] = $langcode; } } diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php index 485a088..381f23b 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/EntityReferenceLabelFormatter.php @@ -105,7 +105,7 @@ public function viewElements(FieldItemListInterface $items) { } $cache_contexts = []; - if ($entity instanceof TranslatableInterface && count($entity->getTranslationLanguages()) > 1) { + if ($entity instanceof TranslatableInterface && $entity->isTranslatable()) { $cache_contexts[] = 'language'; }