You are here

protected function RecentKanbanActivities::buildKanbanLogActivities in Content Planner 8

Builds the log entries.

Parameters

array $logs: An array with the logs.

Return value

array Returns an array with the logs.

1 call to RecentKanbanActivities::buildKanbanLogActivities()
RecentKanbanActivities::build in modules/content_kanban/src/Plugin/DashboardBlock/RecentKanbanActivities.php
Build the block and return a renderable array.

File

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

Class

RecentKanbanActivities
Provides a user block for Content Planner Dashboard.

Namespace

Drupal\content_kanban\Plugin\DashboardBlock

Code

protected function buildKanbanLogActivities(array $logs) {
  $entries = [];
  foreach ($logs as $log) {

    // Get User object.
    $user = $log
      ->getOwner();

    // Get Entity object.
    $entity = $log
      ->getEntityObject();

    // If the Entity or user cannot be found, then continue with the next log.
    if (!$entity || !$user) {
      continue;
    }
    if ($message = $this
      ->composeMessage($log, $user, $entity)) {
      $entry = [
        'user_profile_image' => UserProfileImage::generateProfileImageUrl($user, 'content_kanban_user_thumb'),
        'username' => $user
          ->getAccountName(),
        'message' => $message,
      ];
      $entries[] = $entry;
    }
  }
  return $entries;
}