3 namespace Drupal\embed\Ajax;
5 use Drupal\Core\Ajax\CommandInterface;
6 use Drupal\Core\Ajax\CommandWithAttachedAssetsTrait;
7 use Drupal\Core\Ajax\CommandWithAttachedAssetsInterface;
10 * AJAX command for inserting an embedded item in an editor.
14 class EmbedInsertCommand implements CommandInterface, CommandWithAttachedAssetsInterface {
16 use CommandWithAttachedAssetsTrait;
19 * The content for the matched element(s).
21 * Either a render array or an HTML string.
28 * Constructs an EmbedInsertCommand object.
30 * @param string|array $content
31 * The content that will be inserted in the matched element(s), either a
32 * render array or an HTML string.
34 public function __construct($content) {
35 $this->content = $content;
41 public function render() {
43 'command' => 'embed_insert',
44 'data' => $this->getRenderedContent(),