You are here

public function UserBlock::getUserContentWorkflowCount in Content Planner 8

Get content count for a given user based on workflow status.

Parameters

int $user_id: The user id the get the workflow count for.

string $moderation_state: The moderation state the get the count for.

Return value

int The content count for the given user and the given moderation state.

1 call to UserBlock::getUserContentWorkflowCount()
UserBlock::build in src/Plugin/DashboardBlock/UserBlock.php
Builds the render array for a dashboard block.

File

src/Plugin/DashboardBlock/UserBlock.php, line 135

Class

UserBlock
Provides a user block for Content Planner Dashboard.

Namespace

Drupal\content_planner\Plugin\DashboardBlock

Code

public function getUserContentWorkflowCount($user_id, $moderation_state) {
  $kanban_service = \Drupal::service('content_kanban.kanban_service');
  $filters = [
    'uid' => $user_id,
    'moderation_state' => $moderation_state,
  ];
  $nids = $kanban_service
    ->getEntityIdsFromContentModerationEntities('netnode', $filters);
  return count($nids);
}