function State::getTransitionTo

Same name in other branches
  1. 9 core/modules/workflows/src/State.php \Drupal\workflows\State::getTransitionTo()
  2. 8.9.x core/modules/workflows/src/State.php \Drupal\workflows\State::getTransitionTo()
  3. 10 core/modules/workflows/src/State.php \Drupal\workflows\State::getTransitionTo()

Overrides StateInterface::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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.