function SectionStorageManager::findByContext
Same name in other branches
- 8.9.x core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php \Drupal\layout_builder\SectionStorage\SectionStorageManager::findByContext()
- 10 core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php \Drupal\layout_builder\SectionStorage\SectionStorageManager::findByContext()
- 11.x core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php \Drupal\layout_builder\SectionStorage\SectionStorageManager::findByContext()
Overrides SectionStorageManagerInterface::findByContext
File
-
core/
modules/ layout_builder/ src/ SectionStorage/ SectionStorageManager.php, line 87
Class
- SectionStorageManager
- Provides the Section Storage type plugin manager.
Namespace
Drupal\layout_builder\SectionStorageCode
public function findByContext(array $contexts, RefinableCacheableDependencyInterface $cacheability) {
$storage_types = array_keys($this->contextHandler
->filterPluginDefinitionsByContexts($contexts, $this->getDefinitions()));
// Add the manager as a cacheable dependency in order to vary by changes to
// the plugin definitions.
$cacheability->addCacheableDependency($this);
foreach ($storage_types as $type) {
$plugin = $this->load($type, $contexts);
if ($plugin && $plugin->isApplicable($cacheability)) {
return $plugin;
}
}
return NULL;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.