protected function StateTransitionValidation::getTransitionFromStates in Workbench Moderation 8
Same name and namespace in other branches
- 8.2 src/StateTransitionValidation.php \Drupal\workbench_moderation\StateTransitionValidation::getTransitionFromStates()
Returns the transition object that transitions from one state to another.
Parameters
string $from: The name of the "from" state.
string $to: The name of the "to" state.
Return value
\Drupal\workbench_moderation\Entity\ModerationStateTransition|null A transition object, or NULL if there is no such transition in the system.
1 call to StateTransitionValidation::getTransitionFromStates()
- StateTransitionValidation::userMayTransition in src/
StateTransitionValidation.php - Determines if a user is allowed to transition from one state to another.
1 method overrides StateTransitionValidation::getTransitionFromStates()
- Validator::getTransitionFromStates in tests/
src/ Unit/ StateTransitionValidationTest.php - Returns the transition object that transitions from one state to another.
File
- src/
StateTransitionValidation.php, line 199
Class
- StateTransitionValidation
- Validates whether a certain state transition is allowed.
Namespace
Drupal\workbench_moderationCode
protected function getTransitionFromStates($from, $to) {
$from = $this
->transitionStateQuery()
->condition('stateFrom', $from)
->condition('stateTo', $to)
->execute();
$transitions = $this
->transitionStorage()
->loadMultiple($from);
if ($transitions) {
return current($transitions);
}
return NULL;
}