public SharedTempStore::setIfOwner($key, $value)
Stores a particular key/value pair in this SharedTempStore.
Only stores the given key/value pair if it does not exist yet or is owned by $this->owner.
Parameters
string $key: The key of the data to store.
mixed $value: The data to store.
Return value
bool TRUE if the data was set, or FALSE if it already exists and is not owned by $this->user.
File
- core/modules/user/src/SharedTempStore.php, line 168
Class
- SharedTempStore
- Stores and retrieves temporary data for a given owner.
Namespace
Drupal\user
Code
public function setIfOwner($key, $value) { if ($this->setIfNotExists($key, $value)) { return TRUE; } if (($object = $this->storage->get($key)) && ($object->owner == $this->owner)) { $this->set($key, $value); return TRUE; } return FALSE; }
Please login to continue.