class TestSectionList

Same name in other branches
  1. 9 core/modules/layout_builder/tests/src/Kernel/SectionListTraitTest.php \Drupal\Tests\layout_builder\Kernel\TestSectionList
  2. 8.9.x core/modules/layout_builder/tests/src/Kernel/SectionListTraitTest.php \Drupal\Tests\layout_builder\Kernel\TestSectionList
  3. 11.x core/modules/layout_builder/tests/src/Kernel/SectionListTraitTest.php \Drupal\Tests\layout_builder\Kernel\TestSectionList

Hierarchy

Expanded class hierarchy of TestSectionList

File

core/modules/layout_builder/tests/src/Kernel/SectionListTraitTest.php, line 37

Namespace

Drupal\Tests\layout_builder\Kernel
View source
class TestSectionList implements SectionListInterface {
    use SectionListTrait {
        addBlankSection as public;
    }
    
    /**
     * An array of sections.
     *
     * @var \Drupal\layout_builder\Section[]
     */
    protected $sections;
    
    /**
     * TestSectionList constructor.
     */
    public function __construct(array $sections) {
        // Loop through each section and reconstruct it to ensure that all default
        // values are present.
        foreach ($sections as $section) {
            $this->sections[] = Section::fromArray($section->toArray());
        }
    }
    
    /**
     * {@inheritdoc}
     */
    protected function setSections(array $sections) {
        $this->sections = array_values($sections);
        return $sections;
    }
    
    /**
     * {@inheritdoc}
     */
    public function getSections() {
        return $this->sections;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
SectionListTrait::addBlankSection protected function Adds a blank section to the list.
SectionListTrait::appendSection public function
SectionListTrait::count public function
SectionListTrait::getSection public function
SectionListTrait::hasBlankSection protected function Indicates if this section list contains a blank section.
SectionListTrait::hasSection protected function Indicates if there is a section at the specified delta.
SectionListTrait::insertSection public function
SectionListTrait::removeAllSections public function
SectionListTrait::removeSection public function
SectionListTrait::setSection protected function Sets the section for the given delta on the display.
SectionListTrait::__clone public function Magic method: Implements a deep clone.
TestSectionList::$sections protected property An array of sections.
TestSectionList::getSections public function Gets the layout sections. Overrides SectionListInterface::getSections
TestSectionList::setSections protected function Stores the information for all sections. Overrides SectionListTrait::setSections
TestSectionList::__construct public function TestSectionList constructor.

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