function LayoutSectionItemListTest::getSectionList

Same name in other branches
  1. 9 core/modules/layout_builder/tests/src/Kernel/LayoutSectionItemListTest.php \Drupal\Tests\layout_builder\Kernel\LayoutSectionItemListTest::getSectionList()
  2. 10 core/modules/layout_builder/tests/src/Kernel/LayoutSectionItemListTest.php \Drupal\Tests\layout_builder\Kernel\LayoutSectionItemListTest::getSectionList()

Overrides SectionListTestBase::getSectionList

File

core/modules/layout_builder/tests/src/Kernel/LayoutSectionItemListTest.php, line 32

Class

LayoutSectionItemListTest
Tests the field type for Layout Sections.

Namespace

Drupal\Tests\layout_builder\Kernel

Code

protected function getSectionList(array $section_data) {
    $this->installEntitySchema('entity_test_base_field_display');
    LayoutBuilderEntityViewDisplay::create([
        'targetEntityType' => 'entity_test_base_field_display',
        'bundle' => 'entity_test_base_field_display',
        'mode' => 'default',
        'status' => TRUE,
    ])->enableLayoutBuilder()
        ->setOverridable()
        ->save();
    array_map(function ($row) {
        return [
            'section' => $row,
        ];
    }, $section_data);
    $entity = EntityTestBaseFieldDisplay::create([
        'name' => 'The test entity',
        OverridesSectionStorage::FIELD_NAME => $section_data,
    ]);
    $entity->save();
    return $entity->get(OverridesSectionStorage::FIELD_NAME);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.