ForumController::forumIndex

public ForumController::forumIndex()

Returns forum index page.

Return value

array A render array.

File

core/modules/forum/src/Controller/ForumController.php, line 177

Class

ForumController
Controller routines for forum routes.

Namespace

Drupal\forum\Controller

Code

public function forumIndex() {
  $vocabulary = $this->vocabularyStorage->load($this->config('forum.settings')->get('vocabulary'));
  $index = $this->forumManager->getIndex();
  $build = $this->build($index->forums, $index);
  if (empty($index->forums)) {
    // Root of empty forum.
    $build['#title'] = $this->t('No forums defined');
  }
  else {
    // Set the page title to forum's vocabulary name.
    $build['#title'] = $vocabulary->label();
    $this->renderer->addCacheableDependency($build, $vocabulary);
  }
  return $build;
}
doc_Drupal
2016-10-29 09:17:02
Comments
Leave a Comment

Please login to continue.