You are here

public function BlockFormBase::submitFormAjax in Context 8.0

Same name and namespace in other branches
  1. 8.4 src/Reaction/Blocks/Form/BlockFormBase.php \Drupal\context\Reaction\Blocks\Form\BlockFormBase::submitFormAjax()
  2. 8 src/Reaction/Blocks/Form/BlockFormBase.php \Drupal\context\Reaction\Blocks\Form\BlockFormBase::submitFormAjax()

Handle when the form is submitted trough AJAX.

Return value

AjaxResponse

File

src/Reaction/Blocks/Form/BlockFormBase.php, line 268

Class

BlockFormBase

Namespace

Drupal\context\Reaction\Blocks\Form

Code

public function submitFormAjax() {
  $form = $this->contextManager
    ->getForm($this->context, 'edit');
  $response = new AjaxResponse();
  $response
    ->addCommand(new CloseModalDialogCommand());
  $response
    ->addCommand(new ReplaceCommand('#context-reactions', $form['reactions']));
  return $response;
}