You are here

protected function AjaxController::validatePrivateMessageMemberUsername in Private Message 8

Same name and namespace in other branches
  1. 8.2 src/Controller/AjaxController.php \Drupal\private_message\Controller\AjaxController::validatePrivateMessageMemberUsername()

Create Ajax Command determining whether a given username is valid.

Parameters

Drupal\Core\Ajax\AjaxResponse $response: The response to which any commands should be attached.

1 call to AjaxController::validatePrivateMessageMemberUsername()
AjaxController::ajaxCallback in src/Controller/AjaxController.php
Create AJAX responses for JavaScript requests.

File

src/Controller/AjaxController.php, line 316

Class

AjaxController
Controller to handle Ajax requests.

Namespace

Drupal\private_message\Controller

Code

protected function validatePrivateMessageMemberUsername(AjaxResponse $response) {
  $username = $this->requestStack
    ->getCurrentRequest()
    ->get('username');
  $valid = $this->privateMessageService
    ->validatePrivateMessageMemberUsername($username);
  $response
    ->addCommand(new PrivateMessageMemberUsernameValidatedCommand($username, $valid));
}