function SerializableTempstoreFactory::get

Same name in other branches
  1. 8.x-3.x src/SerializableTempstoreFactory.php \Drupal\ctools\SerializableTempstoreFactory::get()

File

src/SerializableTempstoreFactory.php, line 49

Class

SerializableTempstoreFactory
A factory for creating SerializableTempStore objects.

Namespace

Drupal\ctools

Code

public function get($collection, $owner = NULL) {
    // Use the currently authenticated user ID or the active user ID unless the
    // owner is overridden.
    if (!isset($owner)) {
        $owner = $this->currentUser
            ->id() ?: session_id();
    }
    // Store the data for this collection in the database.
    $storage = $this->storageFactory
        ->get("tempstore.shared.{$collection}");
    return new CoreSharedTempStore($storage, $this->lockBackend, $owner, $this->requestStack, $this->expire);
}