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).

AttachmentSizeStatusTest resultOperations
hook_message_alter.patch2.47 KBIgnored: Check issue status.NoneNone
hook_message_alter.documentation.patch1.06 KBIgnored: Check issue status.NoneNone

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

Status:active» needs work

adjusting status. most likely needs a reroll.

#6

Subscribing.

#7

Status:needs work» closed (duplicate)

Duplicate of #127262: Proposed hook_message_alter.

nobody click here