class NewTopicsBlock

Same name in other branches
  1. 9 core/modules/forum/src/Plugin/Block/NewTopicsBlock.php \Drupal\forum\Plugin\Block\NewTopicsBlock
  2. 10 core/modules/forum/src/Plugin/Block/NewTopicsBlock.php \Drupal\forum\Plugin\Block\NewTopicsBlock
  3. 11.x core/modules/forum/src/Plugin/Block/NewTopicsBlock.php \Drupal\forum\Plugin\Block\NewTopicsBlock

Provides a 'New forum topics' block.

Plugin annotation


@Block(
  id = "forum_new_block",
  admin_label = @Translation("New forum topics"),
  category = @Translation("Lists (Views)")
)

Hierarchy

Expanded class hierarchy of NewTopicsBlock

File

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

Namespace

Drupal\forum\Plugin\Block
View source
class NewTopicsBlock 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.created', 'DESC')
            ->range(0, $this->configuration['block_count']);
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
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
NewTopicsBlock::buildForumQuery protected function Builds the select query to use for this forum block. Overrides ForumBlockBase::buildForumQuery

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