You are here

class PrivateMessageMemberUsernameValidatedCommand in Private Message 8.2

Same name and namespace in other branches
  1. 8 src/Ajax/PrivateMessageMemberUsernameValidatedCommand.php \Drupal\private_message\Ajax\PrivateMessageMemberUsernameValidatedCommand

Ajax command to tell the browser whether a username has been validated.

Hierarchy

Expanded class hierarchy of PrivateMessageMemberUsernameValidatedCommand

1 file declares its use of PrivateMessageMemberUsernameValidatedCommand
AjaxController.php in src/Controller/AjaxController.php

File

src/Ajax/PrivateMessageMemberUsernameValidatedCommand.php, line 10

Namespace

Drupal\private_message\Ajax
View source
class PrivateMessageMemberUsernameValidatedCommand implements CommandInterface {

  /**
   * The username that was validated.
   *
   * @var string
   */
  protected $username;

  /**
   * The user information to be returned sent to the browser.
   *
   * @var bool
   *   A boolean indicating whether the given username is valid to be used as
   * a member in a private message thread.
   */
  protected $validUsername;

  /**
   * Constructs a PrivateMessageMembersAutocompleteResponseCommand object.
   *
   * @param string $username
   *   The username that was validated.
   * @param bool $validUsername
   *   A boolean indicating whether the given username is valid to be used as
   *   a member in a private message thread.
   */
  public function __construct($username, $validUsername) {
    $this->username = $username;
    $this->validUsername = $validUsername;
  }

  /**
   * {@inheritdoc}
   */
  public function render() {
    return [
      'command' => 'privateMessageMemberUsernameValidated',
      'username' => $this->username,
      'validUsername' => $this->validUsername,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PrivateMessageMemberUsernameValidatedCommand::$username protected property The username that was validated.
PrivateMessageMemberUsernameValidatedCommand::$validUsername protected property The user information to be returned sent to the browser.
PrivateMessageMemberUsernameValidatedCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
PrivateMessageMemberUsernameValidatedCommand::__construct public function Constructs a PrivateMessageMembersAutocompleteResponseCommand object.