public function MaestroInteractiveTask::getExecutableForm in Maestro 8.2
Same name and namespace in other branches
- 3.x src/Plugin/EngineTasks/MaestroInteractiveTask.php \Drupal\maestro\Plugin\EngineTasks\MaestroInteractiveTask::getExecutableForm()
Gets the Maestro executable form for a task console.
Parameters
string $modal: Defines if the form is a modal form or not.
Drupal\maestro\Form\MaestroExecuteInteractive $parent: Parent class for using modal callbacks to the interactive form base if needed.
Return value
array Array Must return form declaration fields if this task is interactive or not.
Overrides MaestroEngineTaskInterface::getExecutableForm
File
- src/
Plugin/ EngineTasks/ MaestroInteractiveTask.php, line 96
Class
- MaestroInteractiveTask
- Maestro Interactive Task Plugin.
Namespace
Drupal\maestro\Plugin\EngineTasksCode
public function getExecutableForm($modal, MaestroExecuteInteractive $parent) {
// By default, we will provide a form that has a base queueID field and a submit/reject button set.
// you can override this with ease in your own handler.
// the task console should be looking at whether this requires a handler form or not.
// our implementation forces the handler to be a mandatory field, thus causing functions like: form maestro_accept_only_form in the maestro.module
// file to fire.
// We are hiding this for now, as you can override all of this with your own handler.
$form['queueID'] = [
// This is just a placeholder form to get you under way.
'#type' => 'hidden',
'#title' => $this
->t('The queue ID of this task'),
'#default_value' => $this->queueID,
'#description' => $this
->t('queueID'),
];
$form['information_text'] = [
'#plain_text' => $this
->t('Default Maestro Interactive Task.'),
'#suffix' => '<br><br>',
];
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->t('Complete'),
];
$form['actions']['reject'] = [
'#type' => 'submit',
'#value' => $this
->t('Reject'),
];
if ($modal == 'modal') {
$form['actions']['submit']['#ajax'] = [
'callback' => [
$parent,
'completeForm',
],
'wrapper' => '',
];
$form['actions']['reject']['#ajax'] = [
'callback' => [
$parent,
'completeForm',
],
'wrapper' => '',
];
}
return $form;
}