Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
7473eaf4
Commit
7473eaf4
authored
Nov 12, 2014
by
alexpott
Browse files
Issue
#2371671
by podarok | Chi: Fixed drupal_set_message repeat parameter does not work.
parent
74eb2b9b
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/includes/bootstrap.inc
View file @
7473eaf4
...
@@ -703,11 +703,12 @@ function drupal_set_message($message = NULL, $type = 'status', $repeat = FALSE)
...
@@ -703,11 +703,12 @@ function drupal_set_message($message = NULL, $type = 'status', $repeat = FALSE)
$_SESSION
[
'messages'
][
$type
]
=
array
();
$_SESSION
[
'messages'
][
$type
]
=
array
();
}
}
if
(
$repeat
||
!
in_array
(
$message
,
$_SESSION
[
'messages'
][
$type
]))
{
$new
=
array
(
$_SESSION
[
'messages'
][
$type
][]
=
array
(
'safe'
=>
SafeMarkup
::
isSafe
(
$message
),
'safe'
=>
SafeMarkup
::
isSafe
(
$message
),
'message'
=>
$message
,
'message'
=>
$message
,
);
);
if
(
$repeat
||
!
in_array
(
$new
,
$_SESSION
[
'messages'
][
$type
]))
{
$_SESSION
[
'messages'
][
$type
][]
=
$new
;
}
}
// Mark this page as being uncacheable.
// Mark this page as being uncacheable.
...
...
core/modules/system/src/Tests/Bootstrap/DrupalSetMessageTest.php
View file @
7473eaf4
...
@@ -34,4 +34,13 @@ function testSetRemoveMessages() {
...
@@ -34,4 +34,13 @@ function testSetRemoveMessages() {
$this
->
assertText
(
'Second message (not removed).'
);
$this
->
assertText
(
'Second message (not removed).'
);
}
}
/**
* Tests setting duplicated messages.
*/
function
testDuplicatedMessages
()
{
$this
->
drupalGet
(
'system-test/drupal-set-message'
);
$this
->
assertUniqueText
(
'Non Duplicated message'
);
$this
->
assertNoUniqueText
(
'Duplicated message'
);
}
}
}
core/modules/system/tests/modules/system_test/src/Controller/SystemTestController.php
View file @
7473eaf4
...
@@ -65,6 +65,13 @@ public function drupalSetMessageTest() {
...
@@ -65,6 +65,13 @@ public function drupalSetMessageTest() {
// Remove the first.
// Remove the first.
unset
(
$_SESSION
[
'messages'
][
'status'
][
0
]);
unset
(
$_SESSION
[
'messages'
][
'status'
][
0
]);
// Duplicate message check.
drupal_set_message
(
'Non Duplicated message'
,
'status'
,
FALSE
);
drupal_set_message
(
'Non Duplicated message'
,
'status'
,
FALSE
);
drupal_set_message
(
'Duplicated message'
,
'status'
,
TRUE
);
drupal_set_message
(
'Duplicated message'
,
'status'
,
TRUE
);
return
[];
return
[];
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment