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
8 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards,!16Draft: Resolve #2081585 "History storage",!13Resolve #2903456
...@@ -89,9 +89,15 @@ function _ckeditor_theme_css($theme = NULL) { ...@@ -89,9 +89,15 @@ function _ckeditor_theme_css($theme = NULL) {
if (isset($info['ckeditor_stylesheets'])) { if (isset($info['ckeditor_stylesheets'])) {
$css = $info['ckeditor_stylesheets']; $css = $info['ckeditor_stylesheets'];
foreach ($css as $key => $url) { foreach ($css as $key => $url) {
// CSS url is external.
if (UrlHelper::isExternal($url)) { if (UrlHelper::isExternal($url)) {
$css[$key] = $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 { else {
$css[$key] = $theme_path . '/' . $url; $css[$key] = $theme_path . '/' . $url;
} }
......
...@@ -242,6 +242,14 @@ public function testExternalStylesheets() { ...@@ -242,6 +242,14 @@ public function testExternalStylesheets() {
'core/modules/system/tests/themes/test_ckeditor_stylesheets_relative/css/yokotsoko.css', 'core/modules/system/tests/themes/test_ckeditor_stylesheets_relative/css/yokotsoko.css',
]; ];
$this->assertIdentical($expected, _ckeditor_theme_css('test_ckeditor_stylesheets_relative')); $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() { 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.
Please register or to comment