You are here

abstract class PrivateMessageInsertMessagesCommand in Private Message 8

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

Base class for Ajax command to insert messages into a private message thread.

Hierarchy

Expanded class hierarchy of PrivateMessageInsertMessagesCommand

File

src/Ajax/PrivateMessageInsertMessagesCommand.php, line 10

Namespace

Drupal\private_message\Ajax
View source
abstract class PrivateMessageInsertMessagesCommand implements CommandInterface {

  /**
   * The type of messages to be inserted in the page.
   *
   * Possible values:
   *   - new
   *   - previous.
   *
   * @var string
   */
  protected $insertType;

  /**
   * The HTML for the messages to be inserted in the page.
   *
   * @var string
   */
  protected $messages;

  /**
   * Construct a PrivateMessageInsertMessagesCommand object.
   *
   * @param string $insertType
   *   The type of messages to be inserted in the page. Possible values:
   *     - new
   *     - previous.
   * @param string $messages
   *   The HTML for the messages to be inserted in the page.
   */
  public function __construct($insertType, $messages) {
    $this->insertType = $insertType;
    $this->messages = $messages;
  }

  /**
   * {@inheritdoc}
   */
  public function render() {
    return [
      'command' => 'insertPrivateMessages',
      'insertType' => $this->insertType,
      'messages' => $this->messages,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PrivateMessageInsertMessagesCommand::$insertType protected property The type of messages to be inserted in the page.
PrivateMessageInsertMessagesCommand::$messages protected property The HTML for the messages to be inserted in the page.
PrivateMessageInsertMessagesCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
PrivateMessageInsertMessagesCommand::__construct public function Construct a PrivateMessageInsertMessagesCommand object. 2