public function MaestroTemplateBuilderForm::drawFalseLineTo in Maestro 8.2
Same name and namespace in other branches
- 3.x modules/maestro_template_builder/src/Form/MaestroTemplateBuilderForm.php \Drupal\maestro_template_builder\Form\MaestroTemplateBuilderForm::drawFalseLineTo()
Ajax callback to signal the UI to go into line drawing mode.
File
- modules/
maestro_template_builder/ src/ Form/ MaestroTemplateBuilderForm.php, line 128
Class
Namespace
Drupal\maestro_template_builder\FormCode
public function drawFalseLineTo(array &$form, FormStateInterface $form_state) {
$taskFrom = $form_state
->getValue('task_clicked');
$templateMachineName = $form_state
->getValue('template_machine_name');
$template = MaestroEngine::getTemplate($templateMachineName);
$task = MaestroEngine::getTemplateTaskByID($templateMachineName, $taskFrom);
if ($task['tasktype'] == 'MaestroEnd') {
$response = new AjaxResponse();
$response
->addCommand(new FireJavascriptCommand('maestroSignalError', [
'message' => t('You are not able to draw a line FROM an end task!'),
]));
return $response;
}
$response = new AjaxResponse();
$response
->addCommand(new FireJavascriptCommand('maestroDrawFalseLineTo', [
'taskid' => $taskFrom,
]));
$response
->addCommand(new FireJavascriptCommand('maestroCloseTaskMenu', []));
return $response;
}