You are here

public function State::getTransitionTo in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/workflows/src/State.php \Drupal\workflows\State::getTransitionTo()
  2. 9 core/modules/workflows/src/State.php \Drupal\workflows\State::getTransitionTo()

File

core/modules/workflows/src/State.php, line 88

Class

State
A value object representing a workflow state.

Namespace

Drupal\workflows

Code

public function getTransitionTo($to_state_id) {
  if (!$this
    ->canTransitionTo($to_state_id)) {
    throw new \InvalidArgumentException("Can not transition to '{$to_state_id}' state");
  }
  return $this->workflow
    ->getTransitionFromStateToState($this
    ->id(), $to_state_id);
}