diff --git a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php index 18ec1b457d..5bd3e7b4d4 100644 --- a/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php +++ b/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php @@ -417,7 +417,8 @@ public function setComponent($name, array $options = []) { $configuration = []; $configuration['id'] = 'field_block:' . $this->getTargetEntityTypeId() . ':' . $name; $configuration['label_display'] = FALSE; - $configuration['formatter'] = array_intersect_key($options, array_flip(['type', 'label', 'settings', 'third_party_settings'])); + $keys = array_flip(['type', 'label', 'settings', 'third_party_settings']); + $configuration['formatter'] = array_intersect_key($options, $keys); $configuration['context_mapping']['entity'] = 'layout_builder.entity'; $new_component = (new SectionComponent(\Drupal::service('uuid')->generate(), $options['region'], $configuration)); $section->appendComponent($new_component); diff --git a/core/modules/layout_builder/tests/src/Unit/LayoutTempstoreRepositoryTest.php b/core/modules/layout_builder/tests/src/Unit/LayoutTempstoreRepositoryTest.php index a559368f3d..5d1f691271 100644 --- a/core/modules/layout_builder/tests/src/Unit/LayoutTempstoreRepositoryTest.php +++ b/core/modules/layout_builder/tests/src/Unit/LayoutTempstoreRepositoryTest.php @@ -79,24 +79,73 @@ public function testGetInvalidEntry() { */ class TestSectionStorage implements SectionStorageInterface { + /** + * {@inheritdoc} + */ public static function getStorageType() { return 'my_storage_type'; } + /** + * {@inheritdoc} + */ public function getStorageId() { return 'my_storage_id'; } + /** + * {@inheritdoc} + */ public function count() {} + + /** + * {@inheritdoc} + */ public function getSections() {} + + /** + * {@inheritdoc} + */ public function getSection($delta) {} + + /** + * {@inheritdoc} + */ public function appendSection(Section $section) {} + + /** + * {@inheritdoc} + */ public function insertSection($delta, Section $section) {} + + /** + * {@inheritdoc} + */ public function removeSection($delta) {} + + /** + * {@inheritdoc} + */ public function getContexts() {} + + /** + * {@inheritdoc} + */ public function label() {} + + /** + * {@inheritdoc} + */ public function save() {} + + /** + * {@inheritdoc} + */ public function getCanonicalUrl() {} + + /** + * {@inheritdoc} + */ public function getLayoutBuilderUrl() {} }