public function KeyValueFactory::get
public KeyValueFactory::get($collection)
Constructs a new key/value store for a given collection name.
Parameters
string $collection: The name of the collection holding key and value pairs.
Return value
\Drupal\Core\KeyValueStore\KeyValueStoreInterface A key/value store implementation for the given $collection.
Overrides KeyValueFactoryInterface::get
File
- core/lib/Drupal/Core/KeyValueStore/KeyValueFactory.php, line 61
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]; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!KeyValueStore!KeyValueFactory.php/function/KeyValueFactory::get/8.1.x