3 namespace Drupal\Core\Ajax;
6 * An AJAX command for adding css to the page via ajax.
8 * This command is implemented by Drupal.AjaxCommands.prototype.add_css()
9 * defined in misc/ajax.js.
15 class AddCssCommand implements CommandInterface {
18 * A string that contains the styles to be added to the page.
20 * It should include the wrapping style tag.
27 * Constructs an AddCssCommand.
29 * @param string $styles
30 * A string that contains the styles to be added to the page, including the
31 * wrapping <style> tag.
33 public function __construct($styles) {
34 $this->styles = $styles;
38 * Implements Drupal\Core\Ajax\CommandInterface:render().
40 public function render() {
43 'command' => 'add_css',
44 'data' => $this->styles,