class ActiveTopicsBlock

Provides an 'Active forum topics' block.

Plugin annotation


@Plugin(
  id = "forum_active_block",
  admin_label = @Translation("Active forum topics"),
  module = "forum"
)

Hierarchy

Expanded class hierarchy of ActiveTopicsBlock

File

drupal/core/modules/forum/lib/Drupal/forum/Plugin/Block/ActiveTopicsBlock.php, line 22
Contains \Drupal\forum\Plugin\Block\ActiveTopicsBlock.

Namespace

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

  /**
   * {@inheritdoc}
   */
  public function build() {
    $query = db_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']);
    return array(
      drupal_render_cache_by_query($query, 'forum_block_view'),
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ActiveTopicsBlock::build public function Builds and returns the renderable array for this block plugin. Overrides BlockPluginInterface::build
BlockBase::blockValidate public function Adds block type-specific validation for the block form.
BlockBase::form public function Implements \Drupal\block\BlockPluginInterface::form(). Overrides BlockPluginInterface::form 1
BlockBase::getConfig public function Returns the configuration data for the block plugin.
BlockBase::setConfig public function Sets a particular value in the block settings.
BlockBase::submit public function Implements \Drupal\block\BlockPluginInterface::submit(). Overrides BlockPluginInterface::submit
BlockBase::validate public function Implements \Drupal\block\BlockPluginInterface::validate(). Overrides BlockPluginInterface::validate
BlockBase::__construct public function Constructs a Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct 1
ForumBlockBase::access public function Overrides \Drupal\block\BlockBase::access(). Overrides BlockBase::access
ForumBlockBase::blockForm public function Overrides \Drupal\block\BlockBase::blockForm(). Overrides BlockBase::blockForm
ForumBlockBase::blockSubmit public function Overrides \Drupal\block\BlockBase::blockSubmit(). Overrides BlockBase::blockSubmit
ForumBlockBase::settings public function Overrides \Drupal\block\BlockBase::settings(). Overrides BlockBase::settings
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition.
PluginBase::$pluginId protected property The plugin_id.
PluginBase::getPluginDefinition public function Returns the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition
PluginBase::getPluginId public function Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId