diff --git a/core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php b/core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php index fd14bac830..5ef111dd55 100644 --- a/core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php +++ b/core/modules/layout_builder/src/SectionStorage/SectionStorageManager.php @@ -94,14 +94,19 @@ public function load($type, array $contexts = []) { * {@inheritdoc} */ public function findByContext(array $contexts, RefinableCacheableDependencyInterface $cacheability) { - $storage_types = array_keys($this->contextHandler->filterPluginDefinitionsByContexts($contexts, $this->getDefinitions())); + $storage_types = array_keys($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); + try { + $plugin = $this->load($type, $contexts); + } + catch(ContextException $e) { + continue; + } if ($plugin && $plugin->isApplicable($cacheability)) { return $plugin; } diff --git a/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php b/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php index 02d63841e2..735d848d53 100644 --- a/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php +++ b/core/tests/Drupal/KernelTests/FileSystemModuleDiscoveryDataProviderTrait.php @@ -18,6 +18,7 @@ public function coreModuleListDataProvider() { $module_names = array_map(function ($path) { return str_replace(__DIR__ . '/../../../modules/', '', $path); }, $module_dirs); + sort($module_names); $modules_keyed = array_combine($module_names, $module_names); $data = array_map(function ($module) {