Created
July 28, 2021 16:43
-
-
Save szeidler/6e83925ef5862d68cc9ef20742dc7ac5 to your computer and use it in GitHub Desktop.
Support scheduler entity agnostic changes in scheduler_content_moderation_integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/EventSubscriber/SchedulerEventSubscriber.php b/src/EventSubscriber/SchedulerEventSubscriber.php | |
index ff46ac3..1025ff3 100644 | |
--- a/src/EventSubscriber/SchedulerEventSubscriber.php | |
+++ b/src/EventSubscriber/SchedulerEventSubscriber.php | |
@@ -30,7 +30,9 @@ class SchedulerEventSubscriber implements EventSubscriberInterface { | |
public function publishImmediately(SchedulerEvent $event) { | |
/** @var \Drupal\node\Entity\Node $node */ | |
$node = $event->getNode(); | |
- $node->set('moderation_state', $node->publish_state->getValue()); | |
+ if ($node->hasField('moderation_state')) { | |
+ $node->set('moderation_state', $node->publish_state->getValue()); | |
+ } | |
$event->setNode($node); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment