You are here

public function ForumController::forumPage in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/forum/src/Controller/ForumController.php \Drupal\forum\Controller\ForumController::forumPage()

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.

1 string reference to 'ForumController::forumPage'
forum.routing.yml in core/modules/forum/forum.routing.yml
core/modules/forum/forum.routing.yml

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->termStorage
    ->loadAllParents($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);
}