function NavigationSectionStorage::getSections

Same name in other branches
  1. 10 core/modules/navigation/src/Plugin/SectionStorage/NavigationSectionStorage.php \Drupal\navigation\Plugin\SectionStorage\NavigationSectionStorage::getSections()

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.