You are here

protected function WorkbenchModerationSubscriber::wasDefaultRevision in Workspace 8

Determines if the transition is to a "default revision" state.

Parameters

\Drupal\workbench_moderation\Event\WorkbenchModerationTransitionEvent $event: The transition event.

Return value

bool TRUE if the event is moving an entity to a default-revision state.

1 call to WorkbenchModerationSubscriber::wasDefaultRevision()
WorkbenchModerationSubscriber::onTransition in src/EventSubscriber/WorkbenchModerationSubscriber.php
Listener for workbench moderation event transitions.

File

src/EventSubscriber/WorkbenchModerationSubscriber.php, line 92

Class

WorkbenchModerationSubscriber
Subscriber for workbench transitions.

Namespace

Drupal\workspace\EventSubscriber

Code

protected function wasDefaultRevision(WorkbenchModerationTransitionEvent $event) {

  /** @var Drupal\workbench_moderation\Entity\ModerationState $post_state */
  $post_state = $this->entityTypeManager
    ->getStorage('moderation_state')
    ->load($event
    ->getStateAfter());
  return $post_state
    ->isPublishedState();
}