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.
Since the css file is built using a theme function, if a theme does in fact override that template, the override isn't detected when an admin theme is set and the caches are cleared from within the admin section (this happens whenever a menu item is added) because at that point, the default theme isn't active.
I haven't thought of any obvious solutions to this, although one idea was to generate a separate css file for each theme (eg, menu-icons-THEME.css), and then alter hook_init to check if the css file exists, and if not, generate it then.
Comment | File | Size | Author |
---|---|---|---|
#2 | menu_icons.854530.patch | 2.37 KB | jhedstrom |
#1 | menu_icons.854530.patch | 2.14 KB | jhedstrom |
Comments
Comment #1
jhedstromThe attached patch changes the behavior of this module a bit, but works very nicely with admin themes, or sites that are switching themes.
Instead of generating the CSS file when the caches are cleared, the cache clearing removes the old css cache files. Then, hook_init will generate the new css files on a per-theme basis when hook init is called an the appropriate css file for the theme in use doesn't exist.
Comment #2
jhedstromThe above patch was missing some logic in the menu submit handler to properly clear out the css cache. This patch fixes that.