function SerializableTempstoreFactory::get

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

Overrides SharedTempStoreFactory::get

File

src/SerializableTempstoreFactory.php, line 23

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->currentUser, $this->expire);
}