core/modules/views/src/Entity/View.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php index b3cffba..127f614 100644 --- a/core/modules/views/src/Entity/View.php +++ b/core/modules/views/src/Entity/View.php @@ -8,6 +8,7 @@ namespace Drupal\views\Entity; use Drupal\Component\Utility\NestedArray; +use Drupal\Core\Cache\Cache; use Drupal\Core\Config\Entity\ConfigEntityBase; use Drupal\Core\Entity\EntityStorageInterface; use Drupal\views\Views; @@ -315,10 +316,9 @@ protected function addCacheMetadata() { $executable->setDisplay($display_id); list($display['cache_metadata']['cacheable'], $display['cache_metadata']['contexts']) = $executable->getDisplay()->calculateCacheMetadata(); - // Always include at least the language context as there will be most - // probable translatable strings in the view output. - $display['cache_metadata']['contexts'][] = 'languages'; - $display['cache_metadata']['contexts'] = array_unique($display['cache_metadata']['contexts']); + // Always include at least the 'languages' context as there will most + // probably be translatable strings in the view output. + $display['cache_metadata']['contexts'] = Cache::mergeContexts($display['cache_metadata']['contexts'], ['languages']); } // Restore the previous active display. $executable->setDisplay($current_display);