public function MaestroInteractiveTask::handleExecuteSubmit in Maestro 8.2
Same name and namespace in other branches
- 3.x src/Plugin/EngineTasks/MaestroInteractiveTask.php \Drupal\maestro\Plugin\EngineTasks\MaestroInteractiveTask::handleExecuteSubmit()
Interactive tasks, or tasks that signal themselves as requiring human interaction will have the resulting form submissions sent to their own handler for processing to determine if the task should be completed or not or to carry out any task processing that may have to be done.
Overrides MaestroEngineTaskInterface::handleExecuteSubmit
File
- src/
Plugin/ EngineTasks/ MaestroInteractiveTask.php, line 143
Class
- MaestroInteractiveTask
- Maestro Interactive Task Plugin.
Namespace
Drupal\maestro\Plugin\EngineTasksCode
public function handleExecuteSubmit(array &$form, FormStateInterface $form_state) {
$queueID = intval($form_state
->getValue('maestro_queue_id'));
$triggeringElement = $form_state
->getTriggeringElement();
if (strstr($triggeringElement['#id'], 'edit-submit') !== FALSE && $queueID > 0) {
MaestroEngine::completeTask($queueID, \Drupal::currentUser()
->id());
}
else {
// we'll complete the task, but we'll also flag it as TASK_STATUS_CANCEL.
MaestroEngine::completeTask($queueID, \Drupal::currentUser()
->id());
MaestroEngine::setTaskStatus($queueID, TASK_STATUS_CANCEL);
}
$task = MaestroEngine::getTemplateTaskByQueueID($queueID);
if (isset($task['data']['redirect_to'])) {
$response = new TrustedRedirectResponse($task['data']['redirect_to']);
$form_state
->setResponse($response);
}
}