function Drupal::keyValue

Same name in other branches
  1. 9 core/lib/Drupal.php \Drupal::keyValue()
  2. 10 core/lib/Drupal.php \Drupal::keyValue()
  3. 11.x core/lib/Drupal.php \Drupal::keyValue()

Returns a key/value storage collection.

Parameters

string $collection: Name of the key/value collection to return.

Return value

\Drupal\Core\KeyValueStore\KeyValueStoreInterface

17 calls to Drupal::keyValue()
DrupalTest::testKeyValue in core/tests/Drupal/Tests/Core/DrupalTest.php
Tests the keyValue() method.
EntityAutocomplete::processEntityAutocomplete in core/lib/Drupal/Core/Entity/Element/EntityAutocomplete.php
Adds entity autocomplete functionality to a form element.
EntitySchemaTest::testCleanUpStorageDefinition in core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php
Tests fields from an uninstalled module are removed from the schema.
EntitySchemaTest::testIdentifierSchema in core/tests/Drupal/KernelTests/Core/Entity/EntitySchemaTest.php
Tests the installed storage schema for identifier fields.
EntityUpdateToPublishableTest::setUp in core/modules/system/tests/src/Functional/Update/EntityUpdateToPublishableTest.php
Overrides WebTestBase::setUp() for update testing.

... See full list

File

core/lib/Drupal.php, line 440

Class

Drupal
Static Service Container wrapper.

Code

public static function keyValue($collection) {
    return static::getContainer()->get('keyvalue')
        ->get($collection);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.