function PrivateTempStore::getOwner
Same name in other branches
- 9 core/lib/Drupal/Core/TempStore/PrivateTempStore.php \Drupal\Core\TempStore\PrivateTempStore::getOwner()
- 8.9.x core/lib/Drupal/Core/TempStore/PrivateTempStore.php \Drupal\Core\TempStore\PrivateTempStore::getOwner()
- 11.x core/lib/Drupal/Core/TempStore/PrivateTempStore.php \Drupal\Core\TempStore\PrivateTempStore::getOwner()
Gets the current owner based on the current user or the session ID.
Return value
string The owner.
4 calls to PrivateTempStore::getOwner()
- PrivateTempStore::createKey in core/
lib/ Drupal/ Core/ TempStore/ PrivateTempStore.php - Ensures that the key is unique for a user.
- PrivateTempStore::delete in core/
lib/ Drupal/ Core/ TempStore/ PrivateTempStore.php - Deletes data from the store for a given key and releases the lock on it.
- PrivateTempStore::get in core/
lib/ Drupal/ Core/ TempStore/ PrivateTempStore.php - Retrieves a value from this PrivateTempStore for a given key.
- PrivateTempStore::set in core/
lib/ Drupal/ Core/ TempStore/ PrivateTempStore.php - Stores a particular key/value pair in this PrivateTempStore.
File
-
core/
lib/ Drupal/ Core/ TempStore/ PrivateTempStore.php, line 219
Class
- PrivateTempStore
- Stores and retrieves temporary data for a given owner.
Namespace
Drupal\Core\TempStoreCode
protected function getOwner() {
$owner = $this->currentUser
->id();
if ($this->currentUser
->isAnonymous()) {
// Check to see if an owner key exists in the session.
$session = $this->requestStack
->getSession();
$owner = $session->get('core.tempstore.private.owner');
}
return $owner;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.