function NavigationSectionStorage::getSections

Same name and namespace in other branches
  1. 11.x core/modules/navigation/src/Plugin/SectionStorage/NavigationSectionStorage.php \Drupal\navigation\Plugin\SectionStorage\NavigationSectionStorage::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 NavigationSectionStorage::getSections()
NavigationSectionStorage::save in core/modules/navigation/src/Plugin/SectionStorage/NavigationSectionStorage.php
Saves the sections.

File

core/modules/navigation/src/Plugin/SectionStorage/NavigationSectionStorage.php, line 114

Class

NavigationSectionStorage
Provides navigation section storage.

Namespace

Drupal\navigation\Plugin\SectionStorage

Code

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

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