You are here

class SelectEntitiesCommand in Entity Browser 8

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

AJAX command to rerender a formatted text field without any transformation filters.

Hierarchy

Expanded class hierarchy of SelectEntitiesCommand

File

src/Ajax/SelectEntitiesCommand.php, line 11

Namespace

Drupal\entity_browser\Ajax
View source
class SelectEntitiesCommand implements CommandInterface {

  /**
   * A unique identifier.
   *
   * @var string
   */
  protected $uuid;

  /**
   * A CSS selector string.
   *
   * @var array
   */
  protected $entities;

  /**
   * Constructs a \Drupal\entity_browser\Ajax\SelectEntities object.
   *
   * @param string $uuid
   *   Entity browser instance UUID.
   * @param array $entities
   *   Entities that were selected. Each entity is represented with an array
   *   consisting of three values (entity ID, entity UUID and entity type).
   */
  public function __construct($uuid, $entities) {
    $this->uuid = $uuid;
    $this->entities = $entities;
  }

  /**
   * Implements \Drupal\Core\Ajax\CommandInterface::render().
   */
  public function render() {
    return [
      'command' => 'select_entities',
      'uuid' => $this->uuid,
      'entities' => $this->entities,
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SelectEntitiesCommand::$entities protected property A CSS selector string.
SelectEntitiesCommand::$uuid protected property A unique identifier.
SelectEntitiesCommand::render public function Implements \Drupal\Core\Ajax\CommandInterface::render(). Overrides CommandInterface::render
SelectEntitiesCommand::__construct public function Constructs a \Drupal\entity_browser\Ajax\SelectEntities object.