You are here

public function MaestroTemplateBuilderForm::editTask in Maestro 3.x

Same name and namespace in other branches
  1. 8.2 modules/maestro_template_builder/src/Form/MaestroTemplateBuilderForm.php \Drupal\maestro_template_builder\Form\MaestroTemplateBuilderForm::editTask()

Ajax callback to set a session variable that we use to then signal the modal dialog for task editing to appear.

File

modules/maestro_template_builder/src/Form/MaestroTemplateBuilderForm.php, line 42

Class

MaestroTemplateBuilderForm

Namespace

Drupal\maestro_template_builder\Form

Code

public function editTask(array &$form, FormStateInterface $form_state) {

  // Set a task editing session variable here
  // TODO: if the task menu is changed to a dynamic ajax-generated form based on
  // task capabilities, we won't need this session and the Ajax URL in the edit task
  // callback can pass in the task ID.
  $_SESSION['maestro_template_builder']['maestro_editing_task'] = $form_state
    ->getValue('task_clicked');
  $response = new AjaxResponse();
  $response
    ->addCommand(new FireJavascriptCommand('maestroCloseTaskMenu', []));
  $response
    ->addCommand(new FireJavascriptCommand('maestroEditTask', []));
  return $response;
}