You are here

public function SharedTempStore::get in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/TempStore/SharedTempStore.php \Drupal\Core\TempStore\SharedTempStore::get()
  2. 10 core/lib/Drupal/Core/TempStore/SharedTempStore.php \Drupal\Core\TempStore\SharedTempStore::get()

Retrieves a value from this SharedTempStore for a given key.

Parameters

string $key: The key of the data to retrieve.

Return value

mixed The data associated with the key, or NULL if the key does not exist.

File

core/lib/Drupal/Core/TempStore/SharedTempStore.php, line 133

Class

SharedTempStore
Stores and retrieves temporary data for a given owner.

Namespace

Drupal\Core\TempStore

Code

public function get($key) {
  if ($object = $this->storage
    ->get($key)) {
    return $object->data;
  }
}