function NewTopicsBlock::buildForumQuery

Same name in other branches
  1. 9 core/modules/forum/src/Plugin/Block/NewTopicsBlock.php \Drupal\forum\Plugin\Block\NewTopicsBlock::buildForumQuery()
  2. 8.9.x core/modules/forum/src/Plugin/Block/NewTopicsBlock.php \Drupal\forum\Plugin\Block\NewTopicsBlock::buildForumQuery()
  3. 11.x core/modules/forum/src/Plugin/Block/NewTopicsBlock.php \Drupal\forum\Plugin\Block\NewTopicsBlock::buildForumQuery()

Overrides ForumBlockBase::buildForumQuery

File

core/modules/forum/src/Plugin/Block/NewTopicsBlock.php, line 22

Class

NewTopicsBlock
Provides a 'New 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.created', 'DESC')
        ->range(0, $this->configuration['block_count']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.