function SharedTempStore::getIfOwner
Same name in other branches
- 8.9.x core/lib/Drupal/Core/TempStore/SharedTempStore.php \Drupal\Core\TempStore\SharedTempStore::getIfOwner()
- 10 core/lib/Drupal/Core/TempStore/SharedTempStore.php \Drupal\Core\TempStore\SharedTempStore::getIfOwner()
- 11.x core/lib/Drupal/Core/TempStore/SharedTempStore.php \Drupal\Core\TempStore\SharedTempStore::getIfOwner()
Retrieves a value from this SharedTempStore for a given key.
Only returns the value if the value is owned by $this->owner.
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 150
Class
- SharedTempStore
- Stores and retrieves temporary data for a given owner.
Namespace
Drupal\Core\TempStoreCode
public function getIfOwner($key) {
if (($object = $this->storage
->get($key)) && $object->owner == $this->owner) {
return $object->data;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.