You are here

protected function ActiveTopicsBlock::buildForumQuery in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/forum/src/Plugin/Block/ActiveTopicsBlock.php \Drupal\forum\Plugin\Block\ActiveTopicsBlock::buildForumQuery()

Builds the select query to use for this forum block.

Return value

\Drupal\Core\Database\Query\Select A Select object.

Overrides ForumBlockBase::buildForumQuery

File

core/modules/forum/src/Plugin/Block/ActiveTopicsBlock.php, line 21

Class

ActiveTopicsBlock
Provides an 'Active forum topics' block.

Namespace

Drupal\forum\Plugin\Block

Code

protected function buildForumQuery() {
  return Database::getConnection()
    ->select('forum_index', 'f')
    ->fields('f')
    ->addTag('node_access')
    ->addMetaData('base_table', 'forum_index')
    ->orderBy('f.last_comment_timestamp', 'DESC')
    ->range(0, $this->configuration['block_count']);
}