class SerializableTempstoreFactory

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

A factory for creating SerializableTempStore objects.

Hierarchy

Expanded class hierarchy of SerializableTempstoreFactory

Deprecated

in ctools 8.x-3.10. Will be removed before ctools:4.0.0. Use \Drupal\Core\TempStore\SharedTempStoreFactory instead.

1 string reference to 'SerializableTempstoreFactory'
ctools.services.yml in ./ctools.services.yml
ctools.services.yml
1 service uses SerializableTempstoreFactory
ctools.serializable.tempstore.factory in ./ctools.services.yml
Drupal\ctools\SerializableTempstoreFactory

File

src/SerializableTempstoreFactory.php, line 18

Namespace

Drupal\ctools
View source
class SerializableTempstoreFactory extends SharedTempStoreFactory {
    
    /**
     * {@inheritdoc}
     */
    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);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
SerializableTempstoreFactory::get public function Creates a SharedTempStore for the current user or anonymous session. Overrides SharedTempStoreFactory::get
SharedTempStoreFactory::$currentUser protected property The current user.
SharedTempStoreFactory::$expire protected property The time to live for items in seconds.
SharedTempStoreFactory::$lockBackend protected property The lock object used for this data.
SharedTempStoreFactory::$requestStack protected property The request stack.
SharedTempStoreFactory::$storageFactory protected property The storage factory creating the backend to store the data.
SharedTempStoreFactory::__construct public function Constructs a Drupal\Core\TempStore\SharedTempStoreFactory object.