You are here

public function WorkflowTypeBase::getTransition in Drupal 10

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

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']);
}