parentContext = $parent_context; parent::__construct($parent_context->getStorage(), $parent_context->getEventDispatcher()); } /** * Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::get(). */ public function get($key) { if (array_key_exists($key, $this->data)) { return $this->data[$key]; } else { return $this->parentContext->getData(); } } /** * Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::getMultiple(). */ public function getMultiple(array $keys) { return array_intersect_key($this->data, array_flip($keys)) + $this->parentContext->getMultiple($keys); } /** * Implements Drupal\Core\KeyValueStore\KeyValueStoreInterface::getAll(). */ public function getAll() { return $this->data + $this->parentContext->getAll(); } }