Unverified Commit 610682e9 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3099662 by jibran, dpi, jptaranto, larowlan, nod_: Allow...

Issue #3099662 by jibran, dpi, jptaranto, larowlan, nod_: Allow ckeditor_stylesheets to refer to a Drupal root URL
parent 6cac5d7f
Loading
Loading
Loading
Loading
+6 −0
Changes for core/modules/ckeditor/ckeditor.module: 6 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -89,9 +89,15 @@ function _ckeditor_theme_css($theme = NULL) {
    if (isset($info['ckeditor_stylesheets'])) {
      $css = $info['ckeditor_stylesheets'];
      foreach ($css as $key => $url) {
        // CSS url is external.
        if (UrlHelper::isExternal($url)) {
          $css[$key] = $url;
        }
        // CSS url is relative to Drupal root.
        elseif ($url[0] === '/') {
          $css[$key] = substr($url, 1);
        }
        // CSS url is relative to theme.
        else {
          $css[$key] = $theme_path . '/' . $url;
        }
+8 −0
Changes for core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -242,6 +242,14 @@ public function testExternalStylesheets() {
      'core/modules/system/tests/themes/test_ckeditor_stylesheets_relative/css/yokotsoko.css',
    ];
    $this->assertIdentical($expected, _ckeditor_theme_css('test_ckeditor_stylesheets_relative'));

    // Case 4: Install theme which has a Drupal root CSS URL.
    $theme_installer->install(['test_ckeditor_stylesheets_drupal_root']);
    $this->config('system.theme')->set('default', 'test_ckeditor_stylesheets_drupal_root')->save();
    $expected = [
      'core/modules/system/tests/themes/test_ckeditor_stylesheets_drupal_root/css/yokotsoko.css',
    ];
    $this->assertIdentical($expected, _ckeditor_theme_css('test_ckeditor_stylesheets_drupal_root'));
  }

  protected function getThingsToCheck() {
+4 −0
Changes for core/modules/system/tests/themes/test_ckeditor_stylesheets_drupal_root/css/yokotsoko.css: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
/**
 * @file
 * Test CSS asset file for test_ckeditor_stylesheets_drupal_root.theme.
 */
+9 −0
Changes for core/modules/system/tests/themes/test_ckeditor_stylesheets_drupal_root/test_ckeditor_stylesheets_drupal_root.info.yml: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
name: Test Drupal root CKEditor stylesheets
type: theme
description: 'A theme that uses a Drupal root CKEditor stylesheet.'
package: Testing
version: VERSION
base theme: false

ckeditor_stylesheets:
  - /core/modules/system/tests/themes/test_ckeditor_stylesheets_drupal_root/css/yokotsoko.css