You are here

public function Blocache::prepareContextsFromStorage in Blocache (Block Cache Control) 8

Prepares cache contexts to display them on the block configuration form.

Parameters

array $values: The contexts from third-party setting. An array with the following pattern of values: {cache_context_name}:{cache_context_name_arg}.

Return value

array Returns an array with key => value pairs respecting the standard: {cache_context_name} => {cache_context_name_arg}.

File

src/Blocache.php, line 95

Class

Blocache
Class Blocache.

Namespace

Drupal\blocache

Code

public function prepareContextsFromStorage(array $values) {
  $contexts = [];
  foreach ($values as $key => $value) {
    $value = explode(':', $value);
    $contexts[$value[0]] = isset($value[1]) ? $value[1] : '';
  }
  return $contexts;
}