You are here

public function SchedulerEventSubscriber::publishImmediately in Scheduler content moderation integration 8

Operations to perform after Scheduler publishes a node immediately.

This is during the edit process, not via cron.

Parameters

\Drupal\scheduler\SchedulerEvent $event: The event being acted on.

File

src/EventSubscriber/SchedulerEventSubscriber.php, line 30

Class

SchedulerEventSubscriber
Handle scheduler events.

Namespace

Drupal\scheduler_content_moderation_integration\EventSubscriber

Code

public function publishImmediately(SchedulerEvent $event) {

  /** @var \Drupal\node\Entity\Node $node */
  $node = $event
    ->getNode();
  $node
    ->set('moderation_state', $node->publish_state
    ->getValue());
  $event
    ->setNode($node);
}