diff --git a/core/modules/layout_builder/src/Context/LayoutBuilderContextTrait.php b/core/modules/layout_builder/src/Context/LayoutBuilderContextTrait.php index a11e6ba285..0f0ca89d8f 100644 --- a/core/modules/layout_builder/src/Context/LayoutBuilderContextTrait.php +++ b/core/modules/layout_builder/src/Context/LayoutBuilderContextTrait.php @@ -35,25 +35,18 @@ protected function contextRepository() { * * @param \Drupal\layout_builder\SectionStorageInterface $section_storage * The section storage. - * @param bool $in_preview - * TRUE if the section storage is being previewed, FALSE otherwise. * * @return \Drupal\Core\Plugin\Context\ContextInterface[] * The array of context objects. */ - protected function getAvailableContexts(SectionStorageInterface $section_storage, $in_preview = FALSE) { + protected function getAvailableContexts(SectionStorageInterface $section_storage) { // Get all globally available contexts that have a defined value. $contexts = array_filter($this->contextRepository()->getAvailableContexts(), function (ContextInterface $context) { return $context->hasContextValue(); }); // Add in the per-section_storage contexts. - if ($in_preview) { - $contexts += $section_storage->getContextsDuringPreview(); - } - else { - $contexts += $section_storage->getContexts(); - } + $contexts += $section_storage->getContextsDuringPreview(); return $contexts; } diff --git a/core/modules/layout_builder/src/Controller/LayoutBuilderController.php b/core/modules/layout_builder/src/Controller/LayoutBuilderController.php index 8e13cc24cf..f442ba52b9 100644 --- a/core/modules/layout_builder/src/Controller/LayoutBuilderController.php +++ b/core/modules/layout_builder/src/Controller/LayoutBuilderController.php @@ -226,7 +226,7 @@ protected function buildAdministrativeSection(SectionStorageInterface $section_s $section = $section_storage->getSection($delta); $layout = $section->getLayout(); - $build = $section->toRenderArray($this->getAvailableContexts($section_storage, TRUE), TRUE); + $build = $section->toRenderArray($this->getAvailableContexts($section_storage), TRUE); $layout_definition = $layout->getPluginDefinition(); $region_labels = $layout_definition->getRegionLabels();