You are here

public function WorkflowTypeBase::getTransitions in Drupal 9

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

Gets transition objects for the provided transition IDs.

Parameters

string[] $transition_ids: A list of transition IDs to get. If NULL then all transitions will be returned.

Return value

\Drupal\workflows\TransitionInterface[] An array of transition objects.

Throws

\InvalidArgumentException Thrown if $transition_ids contains a transition ID that does not exist.

Overrides WorkflowTypeInterface::getTransitions

1 call to WorkflowTypeBase::getTransitions()
WorkflowTypeBase::getTransitionsForState in core/modules/workflows/src/Plugin/WorkflowTypeBase.php
Gets the transition IDs for a state for the provided direction.

File

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

Class

WorkflowTypeBase
A base class for Workflow type plugins.

Namespace

Drupal\workflows\Plugin

Code

public function getTransitions(array $transition_ids = NULL) {
  if ($transition_ids === NULL) {
    $transition_ids = array_keys($this->configuration['transitions']);
  }

  /** @var \Drupal\workflows\TransitionInterface[] $transitions */
  $transitions = array_combine($transition_ids, array_map([
    $this,
    'getTransition',
  ], $transition_ids));
  return static::labelWeightMultisort($transitions);
}