You are here

public function Section::toArray in Drupal 8

Same name and namespace in other branches
  1. 9 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 336

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,
  ];
}