protected function StateTransitionValidation::calculatePossibleTransitions in Workbench Moderation 8.2
Same name and namespace in other branches
- 8 src/StateTransitionValidation.php \Drupal\workbench_moderation\StateTransitionValidation::calculatePossibleTransitions()
Computes a mapping of possible transitions.
This method is uncached and will recalculate the list on every request. In most cases you want to use getPossibleTransitions() instead.
Return value
array[] An array containing all possible transitions. Each entry is keyed by the "from" state, and the value is an array of all legal "to" states based on the currently defined transition objects.
See also
static::getPossibleTransitions()
2 calls to StateTransitionValidation::calculatePossibleTransitions()
- StateTransitionValidation::getPossibleTransitions in src/
StateTransitionValidation.php - Returns a mapping of possible transitions.
- StateTransitionValidation::isTransitionAllowed in src/
StateTransitionValidation.php - Determines a transition allowed.
File
- src/
StateTransitionValidation.php, line 60
Class
- StateTransitionValidation
- Validates whether a certain state transition is allowed.
Namespace
Drupal\workbench_moderationCode
protected function calculatePossibleTransitions() {
$transitions = $this
->transitionStorage()
->loadMultiple();
$possible_transitions = [];
/** @var \Drupal\workbench_moderation\ModerationStateTransitionInterface $transition */
foreach ($transitions as $transition) {
$possible_transitions[$transition
->getFromState()][] = $transition
->getToState();
}
return $possible_transitions;
}