2

I have 2 themes enabled on a Drupal 7 installation. The have one css file each included in their .info files:

sites/all/themes/themeA/css/screen.css sites/all/themes/themeB/css/screen.css

The default themeA is the default theme. Using hook_custom_theme, I'm setting the theme to themeB for a certain section of the website based on path. The theme changes successfully and the page renders using themeB when it should.

There is something strange that happens though and the css file from themeA loads as well, breaking parts of the page.

I am checking in hook_css_alter in themeB and there is no mention of themeA/css/screen.css. I am checking in hook_css_alter in themeA and it is never executed.

I have solved this by removing the file from themeA.info and adding it in themeA_css_alter(). I would prefer though and it would be interesting as well to find out why this happens, so that I can put back the the file inclusion where it should normally be.

Any insights?

1 Answer 1

1

The issue was happening on form pages that had CKEditor-enabled fields. The CKEditor module has a configuration option to specify additional CSS to load. By default, it loads the default theme's CSS. After changing this option, everything works as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.