Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_cfg_common
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_cfg_common
Commits
8a0735aa
Commit
8a0735aa
authored
3 years ago
by
Eric Bremner
Committed by
Kevin Paxman
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-5133: updating content moderation to include user id when changing moderation state
parent
e0884cac
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!155
ISTWCMS-5133: updating content moderation to include user id when changing moderation state
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Form/UwContentModerationForm.php
+20
-2
20 additions, 2 deletions
src/Form/UwContentModerationForm.php
with
20 additions
and
2 deletions
src/Form/UwContentModerationForm.php
+
20
−
2
View file @
8a0735aa
...
...
@@ -7,6 +7,7 @@ use Drupal\Core\Entity\EntityTypeManagerInterface;
use
Drupal\Core\Form\ConfirmFormBase
;
use
Drupal\Core\Form\FormStateInterface
;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\Core\Session\AccountProxyInterface
;
use
Drupal\Core\Url
;
use
Drupal\uw_cfg_common
\Service\UWService
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
...
...
@@ -37,14 +38,22 @@ class UwContentModerationForm extends ConfirmFormBase {
*/
protected
$vid
;
/**
* The current user.
*
* @var \Drupal\Core\Session\AccountProxyInterface
*/
protected
$currentUser
;
/**
* Class constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public
function
__construct
(
EntityTypeManagerInterface
$entity_type_manager
)
{
public
function
__construct
(
EntityTypeManagerInterface
$entity_type_manager
,
AccountProxyInterface
$currentUser
)
{
$this
->
entityTypeManager
=
$entity_type_manager
;
$this
->
currentUser
=
$currentUser
;
}
/**
...
...
@@ -53,7 +62,8 @@ class UwContentModerationForm extends ConfirmFormBase {
public
static
function
create
(
ContainerInterface
$container
)
{
// Instantiates this form class.
return
new
static
(
$container
->
get
(
'entity_type.manager'
)
$container
->
get
(
'entity_type.manager'
),
$container
->
get
(
'current_user'
)
);
}
...
...
@@ -143,6 +153,10 @@ class UwContentModerationForm extends ConfirmFormBase {
// two statesL upublish and draft.
if
(
$this
->
status
)
{
// ISTWCMS-5133: adding the uid to the revision, so that
// the correct user is display for who performed the action.
$node
->
set
(
'revision_uid'
,
$this
->
currentUser
->
id
());
// First set the node to unpublished, we need to do this
// because moving it to just draft will not cause it to
// become unpublished.
...
...
@@ -165,6 +179,10 @@ class UwContentModerationForm extends ConfirmFormBase {
// Set the moderation state to publish.
$node
->
set
(
'moderation_state'
,
'published'
);
// ISTWCMS-5133: adding the uid to the revision, so that
// the correct user is display for who performed the action.
$node
->
set
(
'revision_uid'
,
$this
->
currentUser
->
id
());
// Save the node with the moderation state at published.
$saved_status
=
$node
->
save
();
}
...
...
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