You are here

public function SimpleConfigSectionStorage::getSections in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php \Drupal\layout_builder_test\Plugin\SectionStorage\SimpleConfigSectionStorage::getSections()

Gets the layout sections.

Return value

\Drupal\layout_builder\Section[] A sequentially and numerically keyed array of section objects.

Overrides SectionListInterface::getSections

1 call to SimpleConfigSectionStorage::getSections()
SimpleConfigSectionStorage::save in core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php
Saves the sections.

File

core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/SimpleConfigSectionStorage.php, line 104

Class

SimpleConfigSectionStorage
Provides section storage utilizing simple config.

Namespace

Drupal\layout_builder_test\Plugin\SectionStorage

Code

public function getSections() {
  if (is_null($this->sections)) {
    $sections = $this->configFactory
      ->get($this
      ->getConfigName())
      ->get('sections') ?: [];
    $this
      ->setSections(array_map([
      Section::class,
      'fromArray',
    ], $sections));
  }
  return $this->sections;
}