Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
content_update_email_sending
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
content_update_email_sending
Commits
5a5274a5
Commit
5a5274a5
authored
1 year ago
by
Urvashi Vora
Committed by
Ilcho Vuchkov
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3373798
by urvashi_vora, vuil: Fix the issues reported by phpcs
parent
3006fec8
Branches
1.0.x
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
content_update_email_sending.module
+13
-8
13 additions, 8 deletions
content_update_email_sending.module
with
13 additions
and
8 deletions
content_update_email_sending.module
+
13
−
8
View file @
5a5274a5
...
...
@@ -2,7 +2,7 @@
/**
* @file
*
Primary module hooks for
Content Update Email Sending module.
*
Hooks implementation for the
Content Update Email Sending module.
*/
use
Drupal\Core\Entity\EntityInterface
;
...
...
@@ -39,13 +39,19 @@ function content_update_email_sending_mail($key, &$message, $params) {
case
'created'
:
$message
[
'from'
]
=
\Drupal
::
config
(
'system.site'
)
->
get
(
'mail'
);
$message
[
'subject'
]
=
t
(
'New content created: @title'
,
[
'@title'
=>
$params
[
'title'
]],
$options
);
$message
[
'body'
][]
=
t
(
"New content has been added to the website: :link by user ':user'"
,
[
':link'
=>
$params
[
'link'
],
':user'
=>
$params
[
'user'
]]);
$message
[
'body'
][]
=
t
(
"New content has been added to the website: :link by user ':user'"
,
[
':link'
=>
$params
[
'link'
],
':user'
=>
$params
[
'user'
],
]);
break
;
case
'updated'
:
$message
[
'from'
]
=
\Drupal
::
config
(
'system.site'
)
->
get
(
'mail'
);
$message
[
'subject'
]
=
t
(
'Content was updated: @title'
,
[
'@title'
=>
$params
[
'title'
]],
$options
);
$message
[
'body'
][]
=
t
(
"Content has been updated in the website: :link by user ':user'"
,
[
':link'
=>
$params
[
'link'
],
':user'
=>
$params
[
'user'
]]);
$message
[
'body'
][]
=
t
(
"Content has been updated in the website: :link by user ':user'"
,
[
':link'
=>
$params
[
'link'
],
':user'
=>
$params
[
'user'
],
]);
break
;
}
}
...
...
@@ -54,10 +60,9 @@ function content_update_email_sending_mail($key, &$message, $params) {
* Prepare and send an email if conditions met.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
*
*
Entity Interface.
* @param string $key
*
* @return void
* Key.
*/
function
_content_update_email_sending_prepare_email
(
EntityInterface
$entity
,
$key
)
{
$config
=
\Drupal
::
config
(
'content_update_email_sending.settings'
);
...
...
@@ -72,14 +77,14 @@ function _content_update_email_sending_prepare_email(EntityInterface $entity, $k
return
;
}
/* @var \Drupal\user\Entity\User $actor */
/*
*
@var \Drupal\user\Entity\User $actor */
$actor
=
Drupal
::
currentUser
();
/*$roles = $actor->getRoles();
// Don't send emails for changes by content_editor and review_editor.
$ignored_roles = ['content_editor', 'review_editor'];
$dont_notify = !empty(array_intersect($roles, $ignored_roles));
if ($dont_notify) {
return;
return;
}*/
$mailManager
=
\Drupal
::
service
(
'plugin.manager.mail'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment