Hello and thanks for your work on this module!
Currently all of the HTML output is handled within functions. The inner HTML has been moved into a theme function (#2473897: Give themes the ability to theme site alerts.), which is an improvement, but a front end developer would still have to override that function in order to customize the output. I've moved the HTML into template files so that themers can simply copy the files into their own themes to be edited directly.
Two template files are provided:
site-alert.tpl.php - contains the inner html
site-alert-wrapper.tpl.php - contains the outer html <div class="site-alert"></div>
This change should have zero affect on existing installations, even where the theme function is already being overridden.
Thanks!
Patch to follow.
Comment | File | Size | Author |
---|---|---|---|
#5 | interdiff.txt | 1.88 KB | othermachines |
#5 | site_alert-more_themeable-2789657-5.patch | 5.4 KB | othermachines |
Comments
Comment #2
othermachines CreditAttribution: othermachines commentedAs promised. I've also added an empty update function to force a necessary cache clear.
Comment #3
othermachines CreditAttribution: othermachines commentedComment #4
cecrs CreditAttribution: cecrs commentedI think I like this approach. I will review and do some testing on sites with existing installations, the patch is much appreciated! :)
Comment #5
othermachines CreditAttribution: othermachines commentedHi, @cecrs. That's great to hear. :)
Today I fussed with this a bit more and made a couple of changes:
1. I removed the function
theme_site_alert()
since it wasn't actually doing anything and replaced it withtemplate_preprocess_site_alert()
. (It's still OK if themes have implemented their ownTHEME_site_alert()
so updating shouldn't be a problem.)2. This one was a bit tricky. I couldn't get Drupal to recognize the site-alert.tpl.php template when it was in the admin theme (!). After quite a lot of wrangling I discovered that even though it was being registered properly, the callback at
ajax/site_alert
was always loading the default theme. I resolved this by passing the theme and token values contained inDrupal.settings.ajaxPageState
to a theme callback function specified in thehook_menu()
definition. Although it works perfectly I'm not entirely sure this is the proper solution so wouldn't mind some feedback from someone who knows more about the ajax API than I do.Here is some d.o. documentation on the theme callback function:
ajax_base_page_theme()
Thanks!
Comment #7
cecrs CreditAttribution: cecrs commented