function Section::toArray

Same name in other branches
  1. 9 core/modules/layout_builder/src/Section.php \Drupal\layout_builder\Section::toArray()
  2. 8.9.x core/modules/layout_builder/src/Section.php \Drupal\layout_builder\Section::toArray()
  3. 10 core/modules/layout_builder/src/Section.php \Drupal\layout_builder\Section::toArray()

Returns an array representation of the section.

Only use this method if you are implementing custom storage for sections.

Return value

array An array representation of the section component.

File

core/modules/layout_builder/src/Section.php, line 355

Class

Section
Provides a domain object for layout sections.

Namespace

Drupal\layout_builder

Code

public function toArray() {
    return [
        'layout_id' => $this->getLayoutId(),
        'layout_settings' => $this->getLayoutSettings(),
        'components' => array_map(function (SectionComponent $component) {
            return $component->toArray();
        }, $this->getComponents()),
        'third_party_settings' => $this->thirdPartySettings,
    ];
}

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