You are here

class PrivateMessageInboxUpdateCommand in Private Message 8

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

Ajax command to update the private message inbox block.

Hierarchy

Expanded class hierarchy of PrivateMessageInboxUpdateCommand

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

File

src/Ajax/PrivateMessageInboxUpdateCommand.php, line 10

Namespace

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

  /**
   * The thread IDs, in the order that they should appear upon update.
   *
   * @var array
   */
  protected $threadIds;

  /**
   * HTML for any threads that don't currently exist in the inbox.
   *
   * @var array
   */
  protected $newThreads;

  /**
   * Constructs a PrivateMessageInboxUpdateCommand object.
   *
   * @param array $threadIds
   *   The thread IDs, in the order that they should appear when the inbox is
   *   updated.
   * @param array $newThreads
   *   The HTML for the messages to be inserted in the page.
   */
  public function __construct(array $threadIds, array $newThreads) {
    $this->threadIds = $threadIds;
    $this->newThreads = $newThreads;
  }

  /**
   * {@inheritdoc}
   */
  public function render() {
    return [
      'command' => 'privateMessageInboxUpdate',
      'threadIds' => $this->threadIds,
      'newThreads' => $this->newThreads,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PrivateMessageInboxUpdateCommand::$newThreads protected property HTML for any threads that don't currently exist in the inbox.
PrivateMessageInboxUpdateCommand::$threadIds protected property The thread IDs, in the order that they should appear upon update.
PrivateMessageInboxUpdateCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
PrivateMessageInboxUpdateCommand::__construct public function Constructs a PrivateMessageInboxUpdateCommand object.