Version 1
[yaffs-website] / web / core / modules / forum / src / Plugin / Block / ActiveTopicsBlock.php
1 <?php
2
3 namespace Drupal\forum\Plugin\Block;
4
5 /**
6  * Provides an 'Active forum topics' block.
7  *
8  * @Block(
9  *   id = "forum_active_block",
10  *   admin_label = @Translation("Active forum topics"),
11  *   category = @Translation("Lists (Views)")
12  * )
13  */
14 class ActiveTopicsBlock extends ForumBlockBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   protected function buildForumQuery() {
20     return db_select('forum_index', 'f')
21       ->fields('f')
22       ->addTag('node_access')
23       ->addMetaData('base_table', 'forum_index')
24       ->orderBy('f.last_comment_timestamp', 'DESC')
25       ->range(0, $this->configuration['block_count']);
26   }
27
28 }