You are here

class InsertViewCommand in Advanced Insert View 8

Same name and namespace in other branches
  1. 2.0.x src/Ajax/InsertViewCommand.php \Drupal\insert_view_adv\Ajax\InsertViewCommand

AJAX command for inserting an embedded item in an editor.

Hierarchy

Expanded class hierarchy of InsertViewCommand

1 file declares its use of InsertViewCommand
AdvancedInsertViewController.php in src/Controller/AdvancedInsertViewController.php

File

src/Ajax/InsertViewCommand.php, line 14

Namespace

Drupal\insert_view_adv\Ajax
View source
class InsertViewCommand implements CommandInterface, CommandWithAttachedAssetsInterface {
  use CommandWithAttachedAssetsTrait;

  /**
   * The content for the matched element(s).
   *
   * Either a render array or an HTML string.
   *
   * @var string|array
   */
  protected $content;

  /**
   * Constructs an EmbedInsertCommand object.
   *
   * @param string|array $content
   *   The content that will be inserted in the matched element(s), either a
   *   render array or an HTML string.
   */
  public function __construct($content) {
    $this->content = $content;
  }

  /**
   * {@inheritdoc}
   */
  public function render() {
    return [
      'command' => 'insert_view_adv_insert',
      'data' => $this
        ->getRenderedContent(),
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CommandWithAttachedAssetsTrait::$attachedAssets protected property The attached assets for this Ajax command.
CommandWithAttachedAssetsTrait::getAttachedAssets public function Gets the attached assets.
CommandWithAttachedAssetsTrait::getRenderedContent protected function Processes the content for output.
InsertViewCommand::$content protected property The content for the matched element(s).
InsertViewCommand::render public function Return an array to be run through json_encode and sent to the client. Overrides CommandInterface::render
InsertViewCommand::__construct public function Constructs an EmbedInsertCommand object.