public static function KanbanWorkflowService::getWorkflowStates in Content Planner 8
Get Workflow States.
Parameters
\Drupal\workflows\Entity\Workflow $workflow: The workflow object.
Return value
array Returns an array with the available workflow states.
4 calls to KanbanWorkflowService::getWorkflowStates()
- KanbanController::updateEntityWorkflowState in modules/
content_kanban/ src/ Controller/ KanbanController.php - Updates the Workflow state of a given Entity.
- KanbanStatisticService::getWorkflowStateContentCounts in modules/
content_kanban/ src/ KanbanStatisticService.php - Get content counts from a given Workflow.
- KanbanWorkflowService::getCurrentStateLabel in modules/
content_kanban/ src/ KanbanWorkflowService.php - Gets the label of the current state of a given entity.
- RecentKanbanActivities::composeMessage in modules/
content_kanban/ src/ Plugin/ DashboardBlock/ RecentKanbanActivities.php - Composes the message.
File
- modules/
content_kanban/ src/ KanbanWorkflowService.php, line 147
Class
- KanbanWorkflowService
- Class KanbanWorkflowService.
Namespace
Drupal\content_kanbanCode
public static function getWorkflowStates(Workflow $workflow) {
$states = [];
$type_settings = $workflow
->get('type_settings');
// Sort by weight.
uasort($type_settings['states'], function ($a, $b) {
if ($a['weight'] == $b['weight']) {
return 0;
}
elseif ($a['weight'] < $b['weight']) {
return -1;
}
else {
return 1;
}
});
foreach ($type_settings['states'] as $state_id => $state) {
$states[$state_id] = $state['label'];
}
return $states;
}