You are here

public function GridDialog::submitBackStep in CKEditor Bootstrap Grid 2.0.x

Submits a backstep. @todo this should probably just go above.

Parameters

array $form: The form.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Return value

\Drupal\Core\Ajax\AjaxResponse An ajax response.

File

src/Form/GridDialog.php, line 489

Class

GridDialog
Creates a grid dialog form for use in CKEditor.

Namespace

Drupal\ckeditor_bs_grid\Form

Code

public function submitBackStep(array &$form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  $form_state
    ->set('step', $form_state
    ->get('step') === 'advanced' ? 'layout' : 'select');
  $form_state
    ->setRebuild(TRUE);
  $rebuild_form = $this->formBuilder
    ->rebuildForm('ckeditor_bs_grid_dialog', $form_state, $form);
  unset($rebuild_form['#prefix'], $rebuild_form['#suffix']);
  $response
    ->addCommand(new HtmlCommand('#bs_grid-dialog-form', $rebuild_form));
  $response
    ->addCommand(new SetDialogTitleCommand('', $rebuild_form['#title']));
  return $response;
}