You could implement hook_theme_registry_alter() and modify the status_message entry to process through your function. [status_messages] => Array ( [arguments] => Array ( [display] => ) [type] => module [theme path] => modules/system [function] => theme_status_messages [theme paths] => Array ( [0] => modules/system ) [preprocess functions] => Array ( [0] => template_preprocess ) ) You could alter the "theme paths" and "function". Devel Themer does something similar to run every entry in the theme_registry through it's own function. ----- Adam A. Gregory Drupal Developer & Consultant Web: AdamAGregory.com Twitter: twitter.com/adamgregory Phone: 910.808.1717 Cell: 706.761.7375 On Thu, Jan 28, 2010 at 8:22 AM, James Benstead <james.benstead@gmail.com>wrote:
I'm working on this now. My approach is to override theme_status_messages(), so that I can change the status messages right before they're output. I know how to do this in a theme, but how do I do it in a module?
2010/1/25 Adam Gregory <arcaneadam@gmail.com>
Yep, totally agree. There are some issues open to create a
hook_message_alter some of which seem to have some traction, but it will be D8 before this makes it in to core.
----- Adam A. Gregory Drupal Developer & Consultant Web: AdamAGregory.com Twitter: twitter.com/adamgregory Phone: 910.808.1717 Cell: 706.761.7375
On Mon, Jan 25, 2010 at 3:10 PM, Michael Favia <michael.favia@gmail.com>wrote:
On Mon, Jan 25, 2010 at 2:07 PM, Adam Gregory <arcaneadam@gmail.com> wrote:
template_preprocess_page and you can access and alter the message array/variable before it hits the theme.
Technically it has already hit the "theme" because you're editing the preprocess function. But you are correct that hopefully this will work for a single site implementation that needs this. However the need and use for a hook at the module level is still apparent and valid. -mf