You are here

public function StateTransitionValidation::isTransitionAllowed in Workbench Moderation 8.2

Same name and namespace in other branches
  1. 8 src/StateTransitionValidation.php \Drupal\workbench_moderation\StateTransitionValidation::isTransitionAllowed()

Determines a transition allowed.

Parameters

string $from: The from state.

string $to: The to state.

Return value

bool Is the transition allowed.

File

src/StateTransitionValidation.php, line 232

Class

StateTransitionValidation
Validates whether a certain state transition is allowed.

Namespace

Drupal\workbench_moderation

Code

public function isTransitionAllowed($from, $to) {
  $allowed_transitions = $this
    ->calculatePossibleTransitions();
  if (isset($allowed_transitions[$from])) {
    return in_array($to, $allowed_transitions[$from], TRUE);
  }
  return FALSE;
}