function Drupal::keyValue

Same name and namespace in other branches
  1. 9 core/lib/Drupal.php \Drupal::keyValue()
  2. 8.9.x core/lib/Drupal.php \Drupal::keyValue()
  3. 10 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

13 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.
InstallTest::testRequiredModuleSchemaVersions in core/modules/system/tests/src/Kernel/Module/InstallTest.php
Tests recorded schema versions of early installed modules in the installer.

... See full list

File

core/lib/Drupal.php, line 465

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.