public function ForumBlockBase::build in Drupal 10
Same name and namespace in other branches
- 8 core/modules/forum/src/Plugin/Block/ForumBlockBase.php \Drupal\forum\Plugin\Block\ForumBlockBase::build()
- 9 core/modules/forum/src/Plugin/Block/ForumBlockBase.php \Drupal\forum\Plugin\Block\ForumBlockBase::build()
File
- core/
modules/ forum/ src/ Plugin/ Block/ ForumBlockBase.php, line 20
Class
- ForumBlockBase
- Provides a base class for Forum blocks.
Namespace
Drupal\forum\Plugin\BlockCode
public function build() {
$result = $this
->buildForumQuery()
->execute();
$elements = [];
if ($node_title_list = node_title_list($result)) {
$elements['forum_list'] = $node_title_list;
$elements['forum_more'] = [
'#type' => 'more_link',
'#url' => Url::fromRoute('forum.index'),
'#attributes' => [
'title' => $this
->t('Read the latest forum topics.'),
],
];
}
return $elements;
}