function PrivateTempStore::get

Same name in other branches
  1. 9 core/lib/Drupal/Core/TempStore/PrivateTempStore.php \Drupal\Core\TempStore\PrivateTempStore::get()
  2. 8.9.x core/lib/Drupal/Core/TempStore/PrivateTempStore.php \Drupal\Core\TempStore\PrivateTempStore::get()
  3. 11.x core/lib/Drupal/Core/TempStore/PrivateTempStore.php \Drupal\Core\TempStore\PrivateTempStore::get()

Retrieves a value from this PrivateTempStore 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/PrivateTempStore.php, line 104

Class

PrivateTempStore
Stores and retrieves temporary data for a given owner.

Namespace

Drupal\Core\TempStore

Code

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

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