You are here

protected function LayoutBuilderUpdateBlockForm::successfulAjaxSubmit in Panopoly 8.2

Allows the form to respond to a successful AJAX submission.

Parameters

array $form: An associative array containing the structure of the form.

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

Return value

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

Overrides ConfigureBlockFormBase::successfulAjaxSubmit

File

modules/panopoly/panopoly_magic/src/Form/LayoutBuilderUpdateBlockForm.php, line 107

Class

LayoutBuilderUpdateBlockForm
Enhances the update block form with live preview.

Namespace

Drupal\panopoly_magic\Form

Code

protected function successfulAjaxSubmit(array $form, FormStateInterface $form_state) {

  // When in preview mode return the rebuilt layout.
  if ($form_state
    ->getValue('op') == $form['actions']['preview']['#value']) {
    return $this
      ->rebuildLayout($this->sectionStorage);
  }
  return parent::successfulAjaxSubmit($form, $form_state);
}