function SharedTempStore::ensureAnonymousSession
Same name in other branches
- 9 core/lib/Drupal/Core/TempStore/SharedTempStore.php \Drupal\Core\TempStore\SharedTempStore::ensureAnonymousSession()
- 11.x core/lib/Drupal/Core/TempStore/SharedTempStore.php \Drupal\Core\TempStore\SharedTempStore::ensureAnonymousSession()
Stores the owner in the session if the user is anonymous.
This method should be called when a value is set.
2 calls to SharedTempStore::ensureAnonymousSession()
- SharedTempStore::set in core/
lib/ Drupal/ Core/ TempStore/ SharedTempStore.php - Stores a particular key/value pair in this SharedTempStore.
- SharedTempStore::setIfNotExists in core/
lib/ Drupal/ Core/ TempStore/ SharedTempStore.php - Stores a particular key/value pair only if the key doesn't already exist.
File
-
core/
lib/ Drupal/ Core/ TempStore/ SharedTempStore.php, line 301
Class
- SharedTempStore
- Stores and retrieves temporary data for a given owner.
Namespace
Drupal\Core\TempStoreCode
protected function ensureAnonymousSession() {
if ($this->currentUser
->isAnonymous()) {
$this->requestStack
->getSession()
->set('core.tempstore.shared.owner', $this->owner);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.