public function MaestroInteractiveTask::prepareTaskForSave in Maestro 8.2
Same name and namespace in other branches
- 3.x src/Plugin/EngineTasks/MaestroInteractiveTask.php \Drupal\maestro\Plugin\EngineTasks\MaestroInteractiveTask::prepareTaskForSave()
The specific task's manipulation of the values to save for a template save.
Parameters
array $form: The form.
\Drupal\Core\Form\FormStateInterface $form_state: The form's form state.
array $task: The fully loaded task array from the template.
Overrides MaestroEngineTaskInterface::prepareTaskForSave
File
- src/
Plugin/ EngineTasks/ MaestroInteractiveTask.php, line 293
Class
- MaestroInteractiveTask
- Maestro Interactive Task Plugin.
Namespace
Drupal\maestro\Plugin\EngineTasksCode
public function prepareTaskForSave(array &$form, FormStateInterface $form_state, array &$task) {
$task['handler'] = $form_state
->getValue('handler');
/* Test if the interactive function name has comments in it's name
* Defined inside [] so they can appear in the auto-complete result to the user.
* Need to strip these comments out since they are not part of the real function name
*/
if (strpos($task['handler'], '[') > 0) {
$string_parts = explode('[', $task['handler']);
$task['handler'] = $string_parts[0];
}
$task['data']['modal'] = $form_state
->getValue('modal');
$redirect = $form_state
->getValue('redirect_to');
if (isset($redirect)) {
$task['data']['redirect_to'] = $redirect;
}
else {
$task['data']['redirect_to'] = '';
}
}