diff --git a/core/modules/layout_builder/src/Annotation/SectionStorage.php b/core/modules/layout_builder/src/Annotation/SectionStorage.php index 9a52cff5da..0af23a493c 100644 --- a/core/modules/layout_builder/src/Annotation/SectionStorage.php +++ b/core/modules/layout_builder/src/Annotation/SectionStorage.php @@ -44,7 +44,7 @@ class SectionStorage extends Plugin { * * @see \Drupal\layout_builder\SectionStorage\SectionStorageManagerInterface::findByContext() */ - public $context = []; + public $context_definitions = []; /** * {@inheritdoc} diff --git a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php index dd52fdda3e..c84352e85f 100644 --- a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php +++ b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php @@ -276,7 +276,7 @@ public function buildMultiple(array $entities) { * The sections. */ protected function getRuntimeSections(FieldableEntityInterface $entity) { - $sections = NULL; + $overridden_sections = NULL; if ($this->isOverridable()) { /** @var \Drupal\layout_builder\SectionStorageInterface $storage */ @@ -285,12 +285,12 @@ protected function getRuntimeSections(FieldableEntityInterface $entity) { 'view_mode' => new Context(ContextDefinition::create('string'), $this->getMode()), 'entity' => EntityContext::fromEntity($entity), ]); - $sections = $storage ? $storage->getSections() : []; + $overridden_sections = $storage ? $storage->getSections() : []; } // If we don't have a section list yet (i.e., no section storage plugin // was able to derive a section list from context, or this display is not // overridable), use this display as the section list. - return $sections ?: $this->getSections(); + return $overridden_sections ?: $this->getSections(); } /** diff --git a/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php b/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php index 06e5a2036e..ef450de1e2 100644 --- a/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php +++ b/core/modules/layout_builder/src/Plugin/SectionStorage/DefaultsSectionStorage.php @@ -23,7 +23,7 @@ * * @SectionStorage( * id = "defaults", - * context = { + * context_definitions = { * "entity" = @ContextDefinition("entity:entity_view_display"), * }, * ) diff --git a/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php b/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php index b1db3c5a36..b80187c909 100644 --- a/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php +++ b/core/modules/layout_builder/src/Plugin/SectionStorage/OverridesSectionStorage.php @@ -21,7 +21,7 @@ * * @SectionStorage( * id = "overrides", - * context = { + * context_definitions = { * "entity" = @ContextDefinition("entity"), * "view_mode" = @ContextDefinition("string", required = FALSE), * } diff --git a/core/modules/layout_builder/src/SectionStorage/SectionStorageDefinition.php b/core/modules/layout_builder/src/SectionStorage/SectionStorageDefinition.php index 267a499aff..bccd7d1484 100644 --- a/core/modules/layout_builder/src/SectionStorage/SectionStorageDefinition.php +++ b/core/modules/layout_builder/src/SectionStorage/SectionStorageDefinition.php @@ -42,11 +42,11 @@ public function __construct(array $definition = []) { // If there are context definitions in the plugin definition, they should // be added to this object using ::addContextDefinition() so that they can // be manipulated using other ContextAwarePluginDefinitionInterface methods. - if (isset($definition['context'])) { - foreach ($definition['context'] as $name => $context_definition) { + if (isset($definition['context_definitions'])) { + foreach ($definition['context_definitions'] as $name => $context_definition) { $this->addContextDefinition($name, $context_definition); } - unset($definition['context']); + unset($definition['context_definitions']); } foreach ($definition as $property => $value) { diff --git a/core/modules/layout_builder/src/SectionStorageInterface.php b/core/modules/layout_builder/src/SectionStorageInterface.php index 28cc2f915c..8bf3e4a011 100644 --- a/core/modules/layout_builder/src/SectionStorageInterface.php +++ b/core/modules/layout_builder/src/SectionStorageInterface.php @@ -50,7 +50,7 @@ public function getStorageType(); public function buildRoutes(RouteCollection $collection); /** - * Derives the required plugin contexts from route values. + * Derives the available plugin contexts from route values. * * @param mixed $value * The raw value. @@ -62,7 +62,7 @@ public function buildRoutes(RouteCollection $collection); * The route defaults array. * * @return \Drupal\Core\Plugin\Context\ContextInterface[] - * The required plugin contexts. + * The available plugin contexts. */ public function getContextsFromRoute($value, $definition, $name, array $defaults); diff --git a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php index 9de5f2561a..52f3fecf08 100644 --- a/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php +++ b/core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php @@ -23,7 +23,7 @@ * * @SectionStorage( * id = "test_simple_config", - * context = { + * context_definitions = { * "config_id" = @ContextDefinition("string"), * } * )