protected StateTransitionValidation::getTransitionFromStates(ModerationStateInterface $from, ModerationStateInterface $to)
Returns the transition object that transitions from one state to another.
Parameters
\Drupal\content_moderation\ModerationStateInterface $from: The origin state.
\Drupal\content_moderation\ModerationStateInterface $to: The destination state.
Return value
ModerationStateTransition|null A transition object, or NULL if there is no such transition.
File
- core/modules/content_moderation/src/StateTransitionValidation.php, line 177
 
Class
- StateTransitionValidation
 - Validates whether a certain state transition is allowed.
 
Namespace
Drupal\content_moderation
Code
protected function getTransitionFromStates(ModerationStateInterface $from, ModerationStateInterface $to) {
  $from = $this->transitionStateQuery()
    ->condition('stateFrom', $from->id())
    ->condition('stateTo', $to->id())
    ->execute();
  $transitions = $this->transitionStorage()->loadMultiple($from);
  if ($transitions) {
    return current($transitions);
  }
  return NULL;
}
Please login to continue.