class ActiveTopicsBlock

Same name in other branches
  1. 9 core/modules/forum/src/Plugin/Block/ActiveTopicsBlock.php \Drupal\forum\Plugin\Block\ActiveTopicsBlock
  2. 10 core/modules/forum/src/Plugin/Block/ActiveTopicsBlock.php \Drupal\forum\Plugin\Block\ActiveTopicsBlock
  3. 11.x 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

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

Title Sort descending Modifiers Object type Summary Overriden Title
ActiveTopicsBlock::buildForumQuery protected function Builds the select query to use for this forum block. Overrides ForumBlockBase::buildForumQuery
ForumBlockBase::blockAccess protected function
ForumBlockBase::blockForm public function
ForumBlockBase::blockSubmit public function
ForumBlockBase::build public function
ForumBlockBase::defaultConfiguration public function
ForumBlockBase::getCacheContexts public function
ForumBlockBase::getCacheTags public function

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