protected function PrivateTempStore::getOwner in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/TempStore/PrivateTempStore.php \Drupal\Core\TempStore\PrivateTempStore::getOwner()
- 9 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.
File
- core/
lib/ Drupal/ Core/ TempStore/ PrivateTempStore.php, line 224
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.
$this
->startSession();
$session = $this->requestStack
->getCurrentRequest()
->getSession();
$owner = $session
->get('core.tempstore.private.owner');
}
return $owner;
}