function PrivateTempStoreFactory::get

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php \Drupal\Core\TempStore\PrivateTempStoreFactory::get()
  2. 8.9.x core/modules/user/src/PrivateTempStoreFactory.php \Drupal\user\PrivateTempStoreFactory::get()
  3. 8.9.x core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php \Drupal\Core\TempStore\PrivateTempStoreFactory::get()
  4. 10 core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php \Drupal\Core\TempStore\PrivateTempStoreFactory::get()

Creates a PrivateTempStore.

Parameters

string $collection: The collection name to use for this key/value store. This is typically a shared namespace or module name, e.g. 'views', 'entity', etc.

Return value

\Drupal\Core\TempStore\PrivateTempStore An instance of the key/value store.

File

core/lib/Drupal/Core/TempStore/PrivateTempStoreFactory.php, line 82

Class

PrivateTempStoreFactory
Creates a PrivateTempStore object for a given collection.

Namespace

Drupal\Core\TempStore

Code

public function get($collection) {
    // Store the data for this collection in the database.
    $storage = $this->storageFactory
        ->get("tempstore.private.{$collection}");
    return new PrivateTempStore($storage, $this->lockBackend, $this->currentUser, $this->requestStack, $this->expire);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.