class AddStyleSheetCommand in Drupal 8
Same name and namespace in other branches
- 9 core/modules/ckeditor/src/Ajax/AddStyleSheetCommand.php \Drupal\ckeditor\Ajax\AddStyleSheetCommand
AJAX command to add style sheets to a CKEditor instance.
Hierarchy
- class \Drupal\ckeditor\Ajax\AddStyleSheetCommand implements CommandInterface
Expanded class hierarchy of AddStyleSheetCommand
1 file declares its use of AddStyleSheetCommand
- AjaxCssForm.php in core/
modules/ ckeditor/ tests/ modules/ src/ Form/ AjaxCssForm.php
File
- core/
modules/ ckeditor/ src/ Ajax/ AddStyleSheetCommand.php, line 10
Namespace
Drupal\ckeditor\AjaxView source
class AddStyleSheetCommand implements CommandInterface {
/**
* The CKEditor instance ID.
*
* @var string
*/
protected $editorId;
/**
* The style sheet URLs to add to the CKEditor instance.
*
* @var string[]
*/
protected $styleSheets = [];
/**
* AddStyleSheetCommand constructor.
*
* @param string $editor_id
* The CKEditor instance ID.
* @param string[] $stylesheets
* The style sheet URLs to add to the CKEditor instance.
*/
public function __construct($editor_id, array $stylesheets = []) {
$this->editorId = $editor_id;
$this->styleSheets = $stylesheets;
}
/**
* Adds a style sheet to the CKEditor instance.
*
* @param string $stylesheet
* The style sheet URL.
*
* @return $this
* The called object, for chaining.
*/
public function addStyleSheet($stylesheet) {
$this->styleSheets[] = $stylesheet;
return $this;
}
/**
* {@inheritdoc}
*/
public function render() {
return [
'command' => 'ckeditor_add_stylesheet',
'editor_id' => $this->editorId,
'stylesheets' => $this->styleSheets,
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AddStyleSheetCommand:: |
protected | property | The CKEditor instance ID. | |
AddStyleSheetCommand:: |
protected | property | The style sheet URLs to add to the CKEditor instance. | |
AddStyleSheetCommand:: |
public | function | Adds a style sheet to the CKEditor instance. | |
AddStyleSheetCommand:: |
public | function |
Return an array to be run through json_encode and sent to the client. Overrides CommandInterface:: |
|
AddStyleSheetCommand:: |
public | function | AddStyleSheetCommand constructor. |