diff --git a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php index da031bbde6..23999543fc 100644 --- a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php +++ b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php @@ -527,9 +527,9 @@ private function getQuickEditSectionComponent() { // Builder component. It follows the structure prescribed by the // documentation of hook_quickedit_render_field(). if (count($parts) === 6 && $parts[0] === 'layout_builder') { - list(, $delta, $component_uuid, $entity_id) = QuickEditIntegration::deconstructViewModeId($original_mode); + list($view_mode, $delta, $component_uuid, $entity_id) = QuickEditIntegration::deconstructViewModeId($original_mode); $entity = $this->entityTypeManager()->getStorage($this->getTargetEntityTypeId())->load($entity_id); - $sections = $this->getEntitySections($entity); + $sections = $this->getEntitySections($entity, $view_mode); if (isset($sections[$delta])) { $component = $sections[$delta]->getComponent($component_uuid); $plugin = $component->getPlugin(); diff --git a/core/modules/layout_builder/src/LayoutEntityHelperTrait.php b/core/modules/layout_builder/src/LayoutEntityHelperTrait.php index e1c4216ce7..b7f44febc9 100644 --- a/core/modules/layout_builder/src/LayoutEntityHelperTrait.php +++ b/core/modules/layout_builder/src/LayoutEntityHelperTrait.php @@ -63,12 +63,14 @@ protected function getInlineBlockRevisionIdsInSections(array $sections) { * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity. + * @param string $view_mode + * A view mode identifier. * * @return \Drupal\layout_builder\Section[] * The entity layout sections if available. */ - protected function getEntitySections(EntityInterface $entity) { - $section_storage = $this->getSectionStorageForEntity($entity); + protected function getEntitySections(EntityInterface $entity, $view_mode = 'full') { + $section_storage = $this->getSectionStorageForEntity($entity, $view_mode); return $section_storage ? $section_storage->getSections() : []; } @@ -99,14 +101,13 @@ protected function getInlineBlockComponents(array $sections) { * * @param \Drupal\Core\Entity\EntityInterface $entity * The entity. + * @param string $view_mode + * A view mode identifier. * * @return \Drupal\layout_builder\SectionStorageInterface|null - * The section storage if found otherwise NULL. + * The section storage or NULL if its context requirements are not met. */ - protected function getSectionStorageForEntity(EntityInterface $entity) { - // @todo Take into account other view modes in - // https://www.drupal.org/node/3008924. - $view_mode = 'full'; + protected function getSectionStorageForEntity(EntityInterface $entity, $view_mode = 'full') { if ($entity instanceof LayoutEntityDisplayInterface) { $contexts['display'] = EntityContext::fromEntity($entity); }