function WorkflowTypeBase::getTransitionFromStateToState

Same name and namespace in other branches
  1. 9 core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::getTransitionFromStateToState()
  2. 8.9.x core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::getTransitionFromStateToState()
  3. 10 core/modules/workflows/src/Plugin/WorkflowTypeBase.php \Drupal\workflows\Plugin\WorkflowTypeBase::getTransitionFromStateToState()

Overrides WorkflowTypeInterface::getTransitionFromStateToState

File

core/modules/workflows/src/Plugin/WorkflowTypeBase.php, line 346

Class

WorkflowTypeBase
A base class for Workflow type plugins.

Namespace

Drupal\workflows\Plugin

Code

public function getTransitionFromStateToState($from_state_id, $to_state_id) {
    $transition_id = $this->getTransitionIdFromStateToState($from_state_id, $to_state_id);
    if (empty($transition_id)) {
        throw new \InvalidArgumentException("The transition from '{$from_state_id}' to '{$to_state_id}' does not exist in workflow.");
    }
    return $this->getTransition($transition_id);
}

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