You are here

class NewTopicsBlock in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/forum/src/Plugin/Block/NewTopicsBlock.php \Drupal\forum\Plugin\Block\NewTopicsBlock
  2. 9 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

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

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