function LayoutTempstoreRepository::get
Same name in other branches
- 9 core/modules/layout_builder/src/LayoutTempstoreRepository.php \Drupal\layout_builder\LayoutTempstoreRepository::get()
- 10 core/modules/layout_builder/src/LayoutTempstoreRepository.php \Drupal\layout_builder\LayoutTempstoreRepository::get()
- 11.x core/modules/layout_builder/src/LayoutTempstoreRepository.php \Drupal\layout_builder\LayoutTempstoreRepository::get()
Overrides LayoutTempstoreRepositoryInterface::get
File
-
core/
modules/ layout_builder/ src/ LayoutTempstoreRepository.php, line 32
Class
- LayoutTempstoreRepository
- Provides a mechanism for loading layouts from tempstore.
Namespace
Drupal\layout_builderCode
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.