You are here

public function CatalogController::catalogPage in Ubercart 8.4

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

uc_catalog/src/Controller/CatalogController.php, line 22

Class

CatalogController
Controller routines for catalog routes.

Namespace

Drupal\uc_catalog\Controller

Code

public function catalogPage(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);
}