protected function StateTransitionValidation::getTransitionFromStates in Workbench Moderation 8.2
Same name and namespace in other branches
- 8 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
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 - @inheritDoc
File
- src/
StateTransitionValidation.php, line 207
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;
}