It will be better if user can see the status message with node title after publish and unpublished node. Attaching Patch, Please check.

Comments

bsumit5577 created an issue. See original summary.

sumit-k’s picture

sumit-k’s picture

Status: Active » Needs review
rodrigoaguilera’s picture

Version: 8.x-1.0 » 8.x-1.x-dev
Status: Needs review » Needs work

This can be a nice addition to the module. A couple of things

  1. +++ b/src/Controller/PublishContentPublishEntity.php
    @@ -23,7 +25,13 @@ class PublishContentPublishEntity {
    +    $status = (!$node->isPublished()) ? 'unpublished' : 'published';
    

    No need to use negation, just invert the ternary assignment.

    Those two strings need to be translatable too

  2. +++ b/src/Controller/PublishContentPublishEntity.php
    @@ -23,7 +25,13 @@ class PublishContentPublishEntity {
    +    drupal_set_message($this->t('@title has been @status',
    

    This function is deprecated, better use the messenger service

    https://www.drupal.org/node/2774931

deepak goyal’s picture

Assigned: Unassigned » deepak goyal
deepak goyal’s picture

Assigned: deepak goyal » Unassigned
Status: Needs work » Needs review
StatusFileSize
new737 bytes

Hi @rodrigoaguilera
Created new patch please review.

"display-status-message.patch" this patch is not applying.

Checking patch src/Controller/PublishContentPublishEntity.php...
error: while searching for:
use Drupal\node\NodeInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Drupal\Core\Url;

/**
* Toggles node status.
*/
class PublishContentPublishEntity {

/**
* Toggle node status.

error: patch failed: src/Controller/PublishContentPublishEntity.php:5
error: src/Controller/PublishContentPublishEntity.php: patch does not apply

rodrigoaguilera’s picture

Status: Needs review » Fixed

Thank you

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.