You are here

class ActiveTopicsBlock in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/forum/src/Plugin/Block/ActiveTopicsBlock.php \Drupal\forum\Plugin\Block\ActiveTopicsBlock
  2. 9 core/modules/forum/src/Plugin/Block/ActiveTopicsBlock.php \Drupal\forum\Plugin\Block\ActiveTopicsBlock

Provides an 'Active forum topics' block.

Plugin annotation


@Block(
  id = "forum_active_block",
  admin_label = @Translation("Active forum topics"),
  category = @Translation("Lists (Views)")
)

Hierarchy

  • class \Drupal\forum\Plugin\Block\ActiveTopicsBlock extends \Drupal\forum\Plugin\Block\ForumBlockBase

Expanded class hierarchy of ActiveTopicsBlock

File

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

Namespace

Drupal\forum\Plugin\Block
View source
class ActiveTopicsBlock extends ForumBlockBase {

  /**
   * {@inheritdoc}
   */
  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']);
  }

}

Members