You are here

protected function AjaxCssForm::generateResponse in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/ckeditor/tests/modules/src/Form/AjaxCssForm.php \Drupal\ckeditor_test\Form\AjaxCssForm::generateResponse()
  2. 10 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 82

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_get_path('module', 'ckeditor_test') . '/css/test.css';
  $url = file_create_url($url);
  $url = file_url_transform_relative($url);
  $response = new AjaxResponse();
  return $response
    ->addCommand(new AddStyleSheetCommand($editor_id, [
    $url,
  ]));
}