Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
S
simple_sitemap
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
simple_sitemap
Commits
fb1c15b1
Commit
fb1c15b1
authored
Apr 20, 2018
by
gbyte
Committed by
Pawel G
Apr 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2958710
by Prashant.c: Replace usages of the deprecated drupal_set_message() function
parent
3cad69a3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
src/Logger.php
src/Logger.php
+12
-4
No files found.
src/Logger.php
View file @
fb1c15b1
...
...
@@ -2,6 +2,7 @@
namespace
Drupal\simple_sitemap
;
use
Drupal\Core\Messenger\Messenger
;
use
Drupal\Core\StringTranslation\StringTranslationTrait
;
use
Drupal\Core\Session\AccountProxyInterface
;
use
Psr\Log\LoggerInterface
;
...
...
@@ -29,6 +30,11 @@ class Logger {
*/
protected
$logger
;
/**
* @var \Drupal\Core\Messenger\Messenger
*/
protected
$messenger
;
/**
* @var \Drupal\Core\Session\AccountProxyInterface
*/
...
...
@@ -46,15 +52,17 @@ class Logger {
/**
* Logger constructor.
*
* @param
$log
ger
* @param $current_user
*
@param \Psr\Log\LoggerInterface $logger
* @param
\Drupal\Core\Messenger\Messenger $messen
ger
* @param
\Drupal\Core\Session\AccountProxyInterface
$current_user
*/
public
function
__construct
(
LoggerInterface
$logger
,
Messenger
$messenger
,
AccountProxyInterface
$current_user
)
{
$this
->
logger
=
$logger
;
$this
->
messenger
=
$messenger
;
$this
->
currentUser
=
$current_user
;
}
...
...
@@ -85,7 +93,7 @@ class Logger {
*/
public
function
display
(
$displayMessageType
=
self
::
DISPLAY_MESSAGE_TYPE_DEFAULT
,
$permission
=
''
)
{
if
(
empty
(
$permission
)
||
$this
->
currentUser
->
hasPermission
(
$permission
))
{
drupal_set_m
essage
(
$this
->
t
(
$this
->
message
,
$this
->
substitutions
),
$displayMessageType
);
$this
->
messenger
->
addM
essage
(
$this
->
t
(
$this
->
message
,
$this
->
substitutions
),
$displayMessageType
);
}
return
$this
;
}
...
...
Write
Preview
Markdown
is supported
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