You are here

function PrivateTempStoreFactory::get in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/user/src/PrivateTempStoreFactory.php \Drupal\user\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\user\PrivateTempStore An instance of the key/value store.

File

core/modules/user/src/PrivateTempStoreFactory.php, line 83
Contains \Drupal\user\PrivateTempStoreFactory.

Class

PrivateTempStoreFactory
Creates a PrivateTempStore object for a given collection.

Namespace

Drupal\user

Code

function get($collection) {

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