You are here

protected function AjaxCssForm::generateResponse in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/ckeditor/tests/modules/src/Form/AjaxCssForm.php \Drupal\ckeditor_test\Form\AjaxCssForm::generateResponse()

Generates an AJAX response to add CSS to a CKEditor Text Editor instance.

Parameters

string $editor_id: The Text Editor instance ID.

Return value

\Drupal\Core\Ajax\AjaxResponse An AJAX response.

2 calls to AjaxCssForm::generateResponse()
AjaxCssForm::addCssIframe in core/modules/ckeditor/tests/modules/src/Form/AjaxCssForm.php
Handles the AJAX request to add CSS to the iframe editor.
AjaxCssForm::addCssInline in core/modules/ckeditor/tests/modules/src/Form/AjaxCssForm.php
Handles the AJAX request to add CSS to the inline editor.

File

core/modules/ckeditor/tests/modules/src/Form/AjaxCssForm.php, line 108

Class

AjaxCssForm
A form for testing delivery of CSS to CKEditor via AJAX.

Namespace

Drupal\ckeditor_test\Form

Code

protected function generateResponse($editor_id) {

  // Build a URL to the style sheet that will be added.
  $url = \Drupal::service('extension.list.module')
    ->getPath('ckeditor_test') . '/css/test.css';
  $url = $this->fileUrlGenerator
    ->generateString($url);
  $response = new AjaxResponse();
  return $response
    ->addCommand(new AddStyleSheetCommand($editor_id, [
    $url,
  ]));
}