class EmbedInsertCommand in Embed 8
AJAX command for inserting an embedded item in an editor.
Hierarchy
- class \Drupal\embed\Ajax\EmbedInsertCommand implements CommandInterface, CommandWithAttachedAssetsInterface uses CommandWithAttachedAssetsTrait
Expanded class hierarchy of EmbedInsertCommand
1 file declares its use of EmbedInsertCommand
- EmbedController.php in src/
Controller/ EmbedController.php
File
- src/
Ajax/ EmbedInsertCommand.php, line 14
Namespace
Drupal\embed\AjaxView source
class EmbedInsertCommand 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' => 'embed_insert',
'data' => $this
->getRenderedContent(),
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommandWithAttachedAssetsTrait:: |
protected | property | The attached assets for this Ajax command. | |
CommandWithAttachedAssetsTrait:: |
public | function | Gets the attached assets. | |
CommandWithAttachedAssetsTrait:: |
protected | function | Processes the content for output. | |
EmbedInsertCommand:: |
protected | property | The content for the matched element(s). | |
EmbedInsertCommand:: |
public | function |
Return an array to be run through json_encode and sent to the client. Overrides CommandInterface:: |
|
EmbedInsertCommand:: |
public | function | Constructs an EmbedInsertCommand object. |