function WorkflowTypeBase::getTransition

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

Overrides WorkflowTypeInterface::getTransition

1 call to WorkflowTypeBase::getTransition()
WorkflowTypeBase::getTransitionFromStateToState in core/modules/workflows/src/Plugin/WorkflowTypeBase.php
Gets a transition from state to state.

File

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

Class

WorkflowTypeBase
A base class for Workflow type plugins.

Namespace

Drupal\workflows\Plugin

Code

public function getTransition($transition_id) {
    if (!$this->hasTransition($transition_id)) {
        throw new \InvalidArgumentException("The transition '{$transition_id}' does not exist in workflow.");
    }
    return new Transition($this, $transition_id, $this->configuration['transitions'][$transition_id]['label'], $this->configuration['transitions'][$transition_id]['from'], $this->configuration['transitions'][$transition_id]['to'], $this->configuration['transitions'][$transition_id]['weight']);
}

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