public static function MaestroStatus::getMaestroStatusBar in Maestro 8.2
Same name and namespace in other branches
- 3.x src/Utility/MaestroStatus.php \Drupal\maestro\Utility\MaestroStatus::getMaestroStatusBar()
Generates the staus bar showing process completion as status indicators.
Parameters
int $processID: The Maestro Process ID.
int $queueID: The Maestro Queue ID.
bool $skipExecuteCheck: Set to TRUE to skip execution sheck.
3 calls to MaestroStatus::getMaestroStatusBar()
- MaestroProcessStatusBlock::build in src/
Plugin/ Block/ MaestroProcessStatusBlock.php - Builds and returns the renderable array for this block plugin.
- MaestroProcessStatusController::getDetails in src/
Controller/ MaestroProcessStatusController.php - Returns response for the process status queries.
- MaestroTaskConsoleController::getStatus in modules/
maestro_taskconsole/ src/ Controller/ MaestroTaskConsoleController.php - Method to fetch the status of a process.
File
- src/
Utility/ MaestroStatus.php, line 22
Class
- MaestroStatus
- The Maestro status class.
Namespace
Drupal\maestro\UtilityCode
public static function getMaestroStatusBar($processID, $queueID, $skipExecuteCheck = FALSE) {
$build = [];
$status_bar = '';
$canExecute = MaestroEngine::canUserExecuteTask($queueID, \Drupal::currentUser()
->id());
if ($canExecute || $skipExecuteCheck) {
$templateMachineName = MaestroEngine::getTemplateIdFromProcessId($processID);
$template = MaestroEngine::getTemplate($templateMachineName);
$var_workflow_stage_count = intval(MaestroEngine::getProcessVariable('workflow_timeline_stage_count', $processID));
// Shall we show the status bar?
if (isset($template->default_workflow_timeline_stage_count) && intval($template->default_workflow_timeline_stage_count) > 0 && $var_workflow_stage_count > 0) {
// Fetch the currently set status number and message.
$current_status_number = intval(MaestroEngine::getProcessVariable('workflow_current_stage', $processID));
$current_status_message = MaestroEngine::getProcessVariable('workflow_current_stage_message', $processID);
$status_bar = '';
$bar_render_array = [
'#theme' => 'maestro_status_bar',
'#stage_count' => $var_workflow_stage_count,
'#stage_messages' => MaestroEngine::getAllStatusEntriesForProcess($processID),
'#current_stage' => $current_status_number,
'#current_stage_message' => $current_status_message,
];
$status_bar = \Drupal::service('renderer')
->renderPlain($bar_render_array);
// Anyone want to override it?
\Drupal::moduleHandler()
->invokeAll('maestro_task_console_status_bar_alter', [
&$status_bar,
$processID,
]);
}
$build['status_bar'] = [
'#children' => '<div class="maestro-timeline">' . $status_bar . '</div>',
];
}
return $build;
}