You are here

public function PrivateMessageForm::ajaxCallback in Private Message 8

Same name and namespace in other branches
  1. 8.2 src/Form/PrivateMessageForm.php \Drupal\private_message\Form\PrivateMessageForm::ajaxCallback()

Ajax callback for the PrivateMessageForm.

File

src/Form/PrivateMessageForm.php, line 266

Class

PrivateMessageForm
Defines the private message form.

Namespace

Drupal\private_message\Form

Code

public function ajaxCallback(array $form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  $form['message']['widget'][0]['value']['#value'] = '';
  $response
    ->addCommand(new ReplaceCommand(NULL, $form));
  $response
    ->addCommand(new PrivateMessageLoadNewMessagesCommand());
  $response
    ->addCommand(new PrivateMessageInboxTriggerUpdateCommand());
  return $response;
}