Commit 4829acf4 authored by Jonathan Smith's avatar Jonathan Smith Committed by Jonathan Smith
Browse files

Issue #3038046 by jonathan1055, nicrodgers, jonnyhocks: Cater for...

Issue #3038046 by jonathan1055, nicrodgers, jonnyhocks: Cater for workbench_moderation_actions module removing node_publish action
parent d24d1ee3
Loading
Loading
Loading
Loading
+12 −2
Changes for src/SchedulerManager.php: 12 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -253,7 +253,12 @@ class SchedulerManager {

        // Use the standard actions system to publish and save the node.
        $node = $event->getNode();
        $this->entityTypeManager->getStorage('action')->load('node_publish_action')->getPlugin()->execute($node);
        $action_id = 'node_publish_action';
        if ($this->moduleHandler->moduleExists('workbench_moderation_actions')) {
          // workbench_moderation_actions module uses a custom action instead.
          $action_id = 'state_change__node__published';
        }
        $this->entityTypeManager->getStorage('action')->load($action_id)->getPlugin()->execute($node);

        $result = TRUE;
      }
@@ -423,7 +428,12 @@ class SchedulerManager {

        // Use the standard actions system to unpublish and save the node.
        $node = $event->getNode();
        $this->entityTypeManager->getStorage('action')->load('node_unpublish_action')->getPlugin()->execute($node);
        $action_id = 'node_unpublish_action';
        if ($this->moduleHandler->moduleExists('workbench_moderation_actions')) {
          // workbench_moderation_actions module uses a custom action instead.
          $action_id = 'state_change__node__archived';
        }
        $this->entityTypeManager->getStorage('action')->load($action_id)->getPlugin()->execute($node);

        $result = TRUE;
      }