You are here

public function PrivateMessageForm::ajaxCallback in Private Message 8.2

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

Ajax callback for the PrivateMessageForm.

File

src/Form/PrivateMessageForm.php, line 295

Class

PrivateMessageForm
Defines the private message form.

Namespace

Drupal\private_message\Form

Code

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