function LayoutSectionTest::createSectionNode

Same name and namespace in other branches
  1. 8.9.x core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php \Drupal\Tests\layout_builder\Functional\LayoutSectionTest::createSectionNode()
  2. 10 core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php \Drupal\Tests\layout_builder\Functional\LayoutSectionTest::createSectionNode()
  3. 11.x core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php \Drupal\Tests\layout_builder\Functional\LayoutSectionTest::createSectionNode()

Creates a node with a section field.

Parameters

array $section_values: An array of values for a section field.

Return value

\Drupal\node\NodeInterface The node object.

3 calls to LayoutSectionTest::createSectionNode()
LayoutSectionTest::testLayoutPageTitle in core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php
Ensures that the entity title is displayed.
LayoutSectionTest::testLayoutSectionFormatter in core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php
Tests layout_section formatter output.
LayoutSectionTest::testLayoutSectionFormatterAccess in core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php
Tests the access checking of the section formatter.

File

core/modules/layout_builder/tests/src/Functional/LayoutSectionTest.php, line 329

Class

LayoutSectionTest
Tests the rendering of a layout section field.

Namespace

Drupal\Tests\layout_builder\Functional

Code

protected function createSectionNode(array $section_values) {
    return $this->createNode([
        'type' => 'bundle_with_section_field',
        'title' => 'The node title',
        'body' => [
            [
                'value' => 'The node body',
            ],
        ],
        OverridesSectionStorage::FIELD_NAME => $section_values,
    ]);
}

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