public function KanbanStatisticService::getWorkflowStateContentCounts in Content Planner 8
Get content counts from a given Workflow.
Parameters
\Drupal\workflows\Entity\Workflow $workflow: The workflow object.
Return value
array Returns an array with the workflow state content counts.
File
- modules/
content_kanban/ src/ KanbanStatisticService.php, line 36
Class
- KanbanStatisticService
- Class KanbanStatisticService.
Namespace
Drupal\content_kanbanCode
public function getWorkflowStateContentCounts(Workflow $workflow) {
// Get all workflow states form a given workflow.
$workflow_states = KanbanWorkflowService::getWorkflowStates($workflow);
$data = [];
foreach ($workflow_states as $state_id => $state_label) {
$count = $this
->getWorkflowStateContentCount($workflow
->id(), $state_id);
$data[$state_id] = [
'id' => $state_id,
'label' => $state_label,
'count' => $count,
];
}
return $data;
}