public function StatisticsPopularBlock::build

Builds and returns the renderable array for this block plugin.

Return value

array A renderable array representing the content of the block.

Overrides BlockPluginInterface::build

See also

\Drupal\block\BlockRenderController

File

drupal/core/modules/statistics/lib/Drupal/statistics/Plugin/Block/StatisticsPopularBlock.php, line 121
Contains \Drupal\statistics\Plugin\Block\StatisticsPopularBlock.

Class

StatisticsPopularBlock
Provides a 'Popular content' block.

Namespace

Drupal\statistics\Plugin\Block

Code

public function build() {
  $content = array();
  if ($this->day_list) {
    $content['top_day'] = $this->day_list;
    $content['top_day']['#suffix'] = '<br />';
  }
  if ($this->all_time_list) {
    $content['top_all'] = $this->all_time_list;
    $content['top_all']['#suffix'] = '<br />';
  }
  if ($this->last_list) {
    $content['top_last'] = $this->last_list;
    $content['top_last']['#suffix'] = '<br />';
  }
  return $content;
}