Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save szeidler/6e83925ef5862d68cc9ef20742dc7ac5 to your computer and use it in GitHub Desktop.
Save szeidler/6e83925ef5862d68cc9ef20742dc7ac5 to your computer and use it in GitHub Desktop.
Support scheduler entity agnostic changes in scheduler_content_moderation_integration
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