storageFactory = $storage_factory; $this->lockBackend = $lock_backend; $this->currentUser = $current_user; $this->requestStack = $request_stack; $this->expire = $expire; } /** * Creates a PrivateTempStore. * * @param 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 \Drupal\user\PrivateTempStore * An instance of the key/value store. */ public 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); } }