function ForumManager::getIndex

Same name in other branches
  1. 9 core/modules/forum/src/ForumManager.php \Drupal\forum\ForumManager::getIndex()
  2. 10 core/modules/forum/src/ForumManager.php \Drupal\forum\ForumManager::getIndex()
  3. 11.x core/modules/forum/src/ForumManager.php \Drupal\forum\ForumManager::getIndex()

Overrides ForumManagerInterface::getIndex

File

core/modules/forum/src/ForumManager.php, line 449

Class

ForumManager
Provides forum manager service.

Namespace

Drupal\forum

Code

public function getIndex() {
    if ($this->index) {
        return $this->index;
    }
    $vid = $this->configFactory
        ->get('forum.settings')
        ->get('vocabulary');
    $index = $this->entityTypeManager
        ->getStorage('taxonomy_term')
        ->create([
        'tid' => 0,
        'container' => 1,
        'parents' => [],
        'isIndex' => TRUE,
        'vid' => $vid,
    ]);
    // Load the tree below.
    $index->forums = $this->getChildren($vid, 0);
    $this->index = $index;
    return $index;
}

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