You are here

public static function Cache::mergeContexts in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Cache/Cache.php \Drupal\Core\Cache\Cache::mergeContexts()

Merges arrays of cache contexts and removes duplicates.

Parameters

array $a: Cache contexts array to merge.

array $b: Cache contexts array to merge.

Return value

string[] The merged array of cache contexts.

30 calls to Cache::mergeContexts()
ArgumentPluginBase::getCacheContexts in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
The cache contexts associated with this object.
AssertPageCacheContextsAndTagsTrait::assertCacheContexts in core/modules/system/src/Tests/Cache/AssertPageCacheContextsAndTagsTrait.php
Ensures that some cache contexts are present in the current response.
AssertViewsCacheTagsTrait::assertViewsCacheTags in core/modules/views/src/Tests/AssertViewsCacheTagsTrait.php
Asserts a view's result & render cache items' cache tags.
AssertViewsCacheTagsTrait::assertViewsCacheTagsFromStaticRenderArray in core/modules/views/src/Tests/AssertViewsCacheTagsTrait.php
Asserts a view's result & render cache items' cache tags.
BlockContentCacheTagsTest::testBlock in core/modules/block_content/src/Tests/BlockContentCacheTagsTest.php
Tests that the block is cached with the correct contexts and tags.

... See full list

File

core/lib/Drupal/Core/Cache/Cache.php, line 35
Contains \Drupal\Core\Cache\Cache.

Class

Cache
Helper methods for cache.

Namespace

Drupal\Core\Cache

Code

public static function mergeContexts(array $a = [], array $b = []) {
  $cache_contexts = array_unique(array_merge($a, $b));
  assert('\\Drupal::service(\'cache_contexts_manager\')->assertValidTokens($cache_contexts)');
  sort($cache_contexts);
  return $cache_contexts;
}