Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When you set the Editor CSS to 'Use theme CSS', and your site theme is a sub-theme, the base theme CSS is not loaded. Only the CSS for the sub theme is loaded for the theme. Anyone else seeing this? The base themes CSS should be loaded, in my case that is where most of the styles come from.
Comment | File | Size | Author |
---|---|---|---|
#10 | 1330794-10-ckeditor-sub-theme.patch | 8.89 KB | bwaindwain |
#7 | 1330794-7-ckeditor-sub-theme.patch | 8.88 KB | slatty |
#4 | 1330794-ckeditor-admin-subtheme.patch | 2.82 KB | fearlsgroove |
#2 | admin_theme_subsite_use_theme_css-1330794-2.patch | 1.31 KB | m4olivei |
Comments
Comment #1
m4oliveiUpdate: this behavior only occurs when you are using an admin theme for content editing. If you turn off the admin theme, it works as desired.
Comment #2
m4oliveiAnnnnd a patch is attached. Please try, patch is against 7.x-1.x branch.
The issue seems to be that ckeditor module uses variable_get('theme_default', $theme) to decide what the current theme is, which is good, that means the css from the current theme gets grabbed, however the global $base_theme_info variable is set according to what the active theme is, which when you have an admin theme set, as in my case, is seven. So because seven has no base theme, no furthur CSS is included. The patch goes through the array returned by list_themes() to acertain the CSS needed from the base themes.
Comment #3
m4oliveiComment #4
fearlsgroove CreditAttribution: fearlsgroove commentedAttached is a similar effort (found this after the fact somehow). This uses the values already available from the
$theme_info->base_themes
array and thelist_themes()
result. More lines due to indentations and some stylistic changes that you may not prefer ...Comment #5
aleksijohansson CreditAttribution: aleksijohansson at Wunder commented#4 seems to be still a valid patch for the current 7.x-1.x-dev version and works for me!
Comment #7
slatty CreditAttribution: slatty at University of Ottawa commentedThis method includes recursion to also search for sub-themes within sub-themes
Comment #8
lisa.ugray CreditAttribution: lisa.ugray at University of Ottawa commentedI've tested #7 and can verify that it works as intended.
Comment #9
bwaindwain CreditAttribution: bwaindwain as a volunteer commented#7 works for me. Thanks!
Comment #10
bwaindwain CreditAttribution: bwaindwain as a volunteer commentedWith patch #7, I was seeing this message in the browser console "Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost/w288/node/1/sites/all/modules/contrib/ckeditor/css/cked...".
The path to ckeditor.css was missing the initial "/" and, in our case, subfolder. Here's a patch.
Comment #11
Mile23The patch in #7 is listed as a recommended patch against CKEditor for installing with Media: https://www.drupal.org/node/2843391
Comment #13
jcisio CreditAttribution: jcisio at Axess Open Web Services commentedI moved patch #10 around for more logical order and committed. Thanks.
Comment #15
dalemoore CreditAttribution: dalemoore commentedFrom what I can tell this doesn't include CSS added via drupal_add_css in template.php, only CSS added in the info file. Am I mistaken? Or maybe I've somehow introduced a bug in my own setup. If I comment out my added CSS in template.php and move it into the info file, my styles load in CKEditor, but they don't otherwise.