You are here

class PrivateMessageMembersAutocompleteResponseCommand in Private Message 8

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

Ajax command to return autocomplete member results to the browser.

Hierarchy

Expanded class hierarchy of PrivateMessageMembersAutocompleteResponseCommand

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

File

src/Ajax/PrivateMessageMembersAutocompleteResponseCommand.php, line 10

Namespace

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

  /**
   * The string for which results should be returned.
   *
   * @var string
   */
  protected $string;

  /**
   * The user information to be sent to the browser.
   *
   * @var array
   *   An array of user info, with each element of the array containing the
   *   following keys:
   *   - uid: The User ID of the user
   *   - username: The username of the user
   */
  protected $userInfo;

  /**
   * Constructs a PrivateMessageMembersAutocompleteResponseCommand object.
   *
   * @param string $string
   *   The string that was searched for.
   * @param array $userInfo
   *   An array of user info, with each element of the array containing the
   *   following keys:
   *   - uid: The User ID of the user
   *   - username: The username of the user.
   */
  public function __construct($string, array $userInfo) {
    $this->userInfo = $userInfo;
  }

  /**
   * {@inheritdoc}
   */
  public function render() {
    return [
      'command' => 'privateMessageMembersAutocompleteResponse',
      'string' => $this->string,
      'userInfo' => $this->userInfo,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PrivateMessageMembersAutocompleteResponseCommand::$string protected property The string for which results should be returned.
PrivateMessageMembersAutocompleteResponseCommand::$userInfo protected property The user information to be sent to the browser.
PrivateMessageMembersAutocompleteResponseCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
PrivateMessageMembersAutocompleteResponseCommand::__construct public function Constructs a PrivateMessageMembersAutocompleteResponseCommand object.