You are here

public function RecentKanbanActivities::build in Content Planner 8

Build the block and return a renderable array.

Return value

array The render array for the block.

Overrides DashboardBlockBase::build

File

modules/content_kanban/src/Plugin/DashboardBlock/RecentKanbanActivities.php, line 108

Class

RecentKanbanActivities
Provides a user block for Content Planner Dashboard.

Namespace

Drupal\content_kanban\Plugin\DashboardBlock

Code

public function build() {
  $build = [];

  // Get config.
  $config = $this
    ->getConfiguration();

  // Get limit.
  $limit = $this
    ->getCustomConfigByKey($config, 'limit', $this->defaultLimit);

  /* @var $kanban_log_service \Drupal\content_kanban\KanbanLogService */
  $kanban_log_service = \Drupal::service('content_kanban.kanban_log_service');

  // Get Logs.
  if ($logs = $kanban_log_service
    ->getRecentLogs($limit, [
    'exclude_anonymous_users' => TRUE,
  ])) {
    $entries = $this
      ->buildKanbanLogActivities($logs);
    $build = [
      '#theme' => 'content_kanban_log_recent_activity',
      '#entries' => $entries,
      '#show_user_thumb' => $this
        ->getCustomConfigByKey($config, 'show_user_thumb', 0),
    ];
  }
  return $build;
}