public function SectionStorageManager::load in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php \Drupal\layout_builder\SectionStorage\SectionStorageManager::load()
- 9 core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php \Drupal\layout_builder\SectionStorage\SectionStorageManager::load()
Loads a section storage with the provided contexts applied.
Parameters
string $type: The section storage type.
\Drupal\Component\Plugin\Context\ContextInterface[] $contexts: (optional) The contexts available for this storage to use.
Return value
\Drupal\layout_builder\SectionStorageInterface|null The section storage or NULL if its context requirements are not met.
Overrides SectionStorageManagerInterface::load
1 call to SectionStorageManager::load()
- SectionStorageManager::findByContext in core/
modules/ layout_builder/ src/ SectionStorage/ SectionStorageManager.php - Finds the section storage to load based on available contexts.
File
- core/
modules/ layout_builder/ src/ SectionStorage/ SectionStorageManager.php, line 73
Class
- SectionStorageManager
- Provides the Section Storage type plugin manager.
Namespace
Drupal\layout_builder\SectionStorageCode
public function load($type, array $contexts = []) {
$plugin = $this
->loadEmpty($type);
try {
$this->contextHandler
->applyContextMapping($plugin, $contexts);
} catch (ContextException $e) {
return NULL;
}
return $plugin;
}