protected ForumController::build($forums, TermInterface $term, $topics = array(), $parents = array(), $header = array())
Returns a renderable forum index page array.
Parameters
array $forums: A list of forums.
\Drupal\taxonomy\TermInterface $term: The taxonomy term of the forum.
array $topics: The topics of this forum.
array $parents: The parent forums in relation this forum.
array $header: Array of header cells.
Return value
array A render array.
File
- core/modules/forum/src/Controller/ForumController.php, line 210
Class
- ForumController
- Controller routines for forum routes.
Namespace
Drupal\forum\Controller
Code
protected function build($forums, TermInterface $term, $topics = array(), $parents = array(), $header = array()) { $config = $this->config('forum.settings'); $build = array( '#theme' => 'forums', '#forums' => $forums, '#topics' => $topics, '#parents' => $parents, '#header' => $header, '#term' => $term, '#sortby' => $config->get('topics.order'), '#forums_per_page' => $config->get('topics.page_limit'), ); if (empty($term->forum_container->value)) { $build['#attached']['feed'][] = array('taxonomy/term/' . $term->id() . '/feed', 'RSS - ' . $term->getName()); } $this->renderer->addCacheableDependency($build, $config); foreach ($forums as $forum) { $this->renderer->addCacheableDependency($build, $forum); } foreach ($topics as $topic) { $this->renderer->addCacheableDependency($build, $topic); } foreach ($parents as $parent) { $this->renderer->addCacheableDependency($build, $parent); } $this->renderer->addCacheableDependency($build, $term); return [ 'action' => $this->buildActionLinks($config->get('vocabulary'), $term), 'forum' => $build, '#cache' => [ 'tags' => Cache::mergeTags($this->nodeEntityTypeDefinition->getListCacheTags(), $this->commentEntityTypeDefinition->getListCacheTags()), ], ]; }
Please login to continue.