Jump to:
| Project: | Drupal core |
| Version: | 7.x-dev |
| Component: | base system |
| Category: | feature request |
| Priority: | normal |
| Assigned: | floretan |
| Status: | closed (duplicate) |
Issue Summary
Being able to alter messages set with drupal_set_message() is a simple but relatively important feature for sites where a high level of customization is required. Currently, messages are stored in the $_SESSION variable without an array index that could be used to identify them.
The first patch adds a $message_id parameter to drupal_set_message(). This parameter is redundant with the current $repeat parameter which is only used once in drupal core. A call to hook_message_alter is added inside of drupal_get_message().
The second patch provides documentation for the new hook_message_alter().
This first step consists of making messages identifiable and alterable with hook_message_alter(). The second step will be to add message id's to drupal_set_message() calls where appropriate (messages of type 'error' should probably not have a message id, we generally don't want to make them alterable).
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| hook_message_alter.patch | 2.47 KB | Ignored: Check issue status. | None | None |
| hook_message_alter.documentation.patch | 1.06 KB | Ignored: Check issue status. | None | None |
Comments
#1
Subscribe.
#2
I'm all for it. Modifying messages at the moment is a pain and hacky at best. +1
#3
Having just modded yet another version of a drupal_set_message error that shows up inside the user_login block, I feel compelled to agreed with csev in #2.
I'll test this out later today and RTBC it.
#4
+1 for this feature.
Would appreciate any tips / links on how to do this in Drupal 6 for now.
#5
adjusting status. most likely needs a reroll.
#6
Subscribing.
#7
Duplicate of #127262: Proposed hook_message_alter.