ForumController::forumPage

public ForumController::forumPage(TermInterface $taxonomy_term)

Returns forum page for a given forum.

Parameters

\Drupal\taxonomy\TermInterface $taxonomy_term: The forum to render the page for.

Return value

array A render array.

File

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

Class

ForumController
Controller routines for forum routes.

Namespace

Drupal\forum\Controller

Code

public function forumPage(TermInterface $taxonomy_term) {
  // Get forum details.
  $taxonomy_term->forums = $this->forumManager->getChildren($this->config('forum.settings')->get('vocabulary'), $taxonomy_term->id());
  $taxonomy_term->parents = $this->forumManager->getParents($taxonomy_term->id());

  if (empty($taxonomy_term->forum_container->value)) {
    $build = $this->forumManager->getTopics($taxonomy_term->id(), $this->currentUser());
    $topics = $build['topics'];
    $header = $build['header'];
  }
  else {
    $topics = [];
    $header = [];
  }
  return $this->build($taxonomy_term->forums, $taxonomy_term, $topics, $taxonomy_term->parents, $header);
}
doc_Drupal
2016-10-29 09:17:03
Comments
Leave a Comment

Please login to continue.