StateTransitionValidation::calculatePossibleTransitions

protected 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()

File

core/modules/content_moderation/src/StateTransitionValidation.php, line 63

Class

StateTransitionValidation
Validates whether a certain state transition is allowed.

Namespace

Drupal\content_moderation

Code

protected function calculatePossibleTransitions() {
  $transitions = $this->transitionStorage()->loadMultiple();

  $possible_transitions = [];
  /** @var \Drupal\content_moderation\ModerationStateTransitionInterface $transition */
  foreach ($transitions as $transition) {
    $possible_transitions[$transition->getFromState()][] = $transition->getToState();
  }
  return $possible_transitions;
}
doc_Drupal
2016-10-29 09:44:17
Comments
Leave a Comment

Please login to continue.