getTempstore example


  public function __construct(SharedTempStoreFactory $temp_store_factory) {
    $this->tempStoreFactory = $temp_store_factory;
  }

  /** * {@inheritdoc} */
  public function get(SectionStorageInterface $section_storage) {
    $key = $this->getKey($section_storage);
    $tempstore = $this->getTempstore($section_storage)->get($key);
    if (!empty($tempstore['section_storage'])) {
      $storage_type = $section_storage->getStorageType();
      $section_storage = $tempstore['section_storage'];

      if (!($section_storage instanceof SectionStorageInterface)) {
        throw new \UnexpectedValueException(sprintf('The entry with storage type "%s" and ID "%s" is invalid', $storage_type$key));
      }
    }
    return $section_storage;
  }

  
Home | Imprint | This part of the site doesn't use cookies.