From a0ead5b6a575af906fc88a4ff2f3696d49a5c506 Mon Sep 17 00:00:00 2001 From: Maarten Segers Date: Sat, 16 Jun 2018 22:53:53 +0200 Subject: [PATCH] #70 --- src/SchedulerManager.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/SchedulerManager.php b/src/SchedulerManager.php index 1d8ca3a..0c1c833 100644 --- a/src/SchedulerManager.php +++ b/src/SchedulerManager.php @@ -207,14 +207,6 @@ class SchedulerManager { ]; $this->logger->notice('@type: scheduled publishing of %title.', $logger_variables); - // Use the actions system to publish the node. - $this->entityTypeManager->getStorage('action')->load('node_publish_action')->getPlugin()->execute($node); - - // Invoke the event to tell Rules that Scheduler has published the node. - if ($this->moduleHandler->moduleExists('scheduler_rules_integration')) { - _scheduler_rules_integration_dispatch_cron_event($node, 'publish'); - } - // If scheduler_content_moderation_integration is enabled, set to // published state. if ($this->schedulerModerationEnabled && $node->get('moderation_state')) { @@ -223,11 +215,18 @@ class SchedulerManager { $node->publish_state->value = NULL; } + // Use the actions system to publish the node. + $this->entityTypeManager->getStorage('action')->load('node_publish_action')->getPlugin()->execute($node); + + // Invoke the event to tell Rules that Scheduler has published the node. + if ($this->moduleHandler->moduleExists('scheduler_rules_integration')) { + _scheduler_rules_integration_dispatch_cron_event($node, 'publish'); + } + // Trigger the PUBLISH event so that modules can react after the node is // published. $event = new SchedulerEvent($node); $dispatcher->dispatch(SchedulerEvents::PUBLISH, $event); - $event->getNode()->save(); $result = TRUE; } -- 2.15.1