function AjaxCssForm::generateResponse

Same name in other branches
  1. 9 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,
    ]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.