Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -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() {
......
/**
* @file
* Test CSS asset file for test_ckeditor_stylesheets_drupal_root.theme.
*/
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment