You are here

public function DeleteStyles::ajaxCancel in Block Style Plugins 8.2

Provides an ajax callback for the cancel button.

File

src/Form/DeleteStyles.php, line 168

Class

DeleteStyles
Provides a form to delete a block style.

Namespace

Drupal\block_style_plugins\Form

Code

public function ajaxCancel(array &$form, FormStateInterface $form_state) {
  $parameters = $this
    ->getParameters();
  $new_form = $this->formBuilder
    ->getForm(BlockStyleForm::class, $this->sectionStorage, $parameters['delta'], $parameters['uuid']);
  $new_form['#action'] = $this
    ->getCancelUrl()
    ->toString();
  $response = new AjaxResponse();
  $response
    ->addCommand(new OpenOffCanvasDialogCommand($this
    ->t('Configure Styles'), $new_form));
  return $response;
}