function KeyValueFactory::get
Same name in other branches
- 8.9.x core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php \Drupal\Core\KeyValueStore\KeyValueFactory::get()
- 10 core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php \Drupal\Core\KeyValueStore\KeyValueFactory::get()
- 11.x core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php \Drupal\Core\KeyValueStore\KeyValueFactory::get()
Overrides KeyValueFactoryInterface::get
File
-
core/
lib/ Drupal/ Core/ KeyValueStore/ KeyValueFactory.php, line 70
Class
- KeyValueFactory
- Defines the key/value store factory.
Namespace
Drupal\Core\KeyValueStoreCode
public function get($collection) {
if (!isset($this->stores[$collection])) {
if (isset($this->options[$collection])) {
$service_id = $this->options[$collection];
}
elseif (isset($this->options[static::DEFAULT_SETTING])) {
$service_id = $this->options[static::DEFAULT_SETTING];
}
else {
$service_id = static::DEFAULT_SERVICE;
}
$this->stores[$collection] = $this->container
->get($service_id)
->get($collection);
}
return $this->stores[$collection];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.