- Modified patch #133318 by hunmonk: drupal_get_messages() returning incorrect array value.
Backport from HEAD.5.x
parent
815427e1da
commit
94e51b24be
|
@ -677,6 +677,11 @@ function drupal_set_message($message = NULL, $type = 'status') {
|
|||
* (optional) Only return messages of this type.
|
||||
* @param $clear_queue
|
||||
* (optional) Set to FALSE if you do not want to clear the messages queue
|
||||
* @return
|
||||
* An associative array, the key is the message type, the value an array
|
||||
* of messages. If the $type parameter is passed, you get only that type,
|
||||
* or an empty array if there are no such messages. If $type is not passed,
|
||||
* all message types are returned, or an empty array if none exist.
|
||||
*/
|
||||
function drupal_get_messages($type = NULL, $clear_queue = TRUE) {
|
||||
if ($messages = drupal_set_message()) {
|
||||
|
@ -684,7 +689,9 @@ function drupal_get_messages($type = NULL, $clear_queue = TRUE) {
|
|||
if ($clear_queue) {
|
||||
unset($_SESSION['messages'][$type]);
|
||||
}
|
||||
return array($type => $messages[$type]);
|
||||
if (isset($messages[$type])) {
|
||||
return array($type => $messages[$type]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($clear_queue) {
|
||||
|
|
Loading…
Reference in New Issue