class AddStyleSheetCommand
Same name in other branches
- 8.9.x 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 \Drupal\Core\Ajax\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
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
AddStyleSheetCommand::$editorId | protected | property | The CKEditor instance ID. | |
AddStyleSheetCommand::$styleSheets | protected | property | The style sheet URLs to add to the CKEditor instance. | |
AddStyleSheetCommand::addStyleSheet | public | function | Adds a style sheet to the CKEditor instance. | |
AddStyleSheetCommand::render | public | function | Return an array to be run through json_encode and sent to the client. | Overrides CommandInterface::render |
AddStyleSheetCommand::__construct | public | function | AddStyleSheetCommand constructor. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.