function WorkflowTypeBase::getTransitionsForState

Gets the transition IDs for a state for the provided direction.

Parameters

$state_id: The state to get transitions for.

string $direction: (optional) The direction of the transition, defaults to TransitionInterface::DIRECTION_FROM. Possible values are: TransitionInterface::DIRECTION_FROM or TransitionInterface::DIRECTION_TO.

Return value

array The transition IDs for a state for the provided direction.

Overrides WorkflowTypeInterface::getTransitionsForState

File

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

Class

WorkflowTypeBase
A base class for Workflow type plugins.

Namespace

Drupal\workflows\Plugin

Code

public function getTransitionsForState($state_id, $direction = TransitionInterface::DIRECTION_FROM) {
  $transition_ids = array_keys(array_filter($this->configuration['transitions'], function ($transition) use ($state_id, $direction) {
    return in_array($state_id, (array) $transition[$direction], TRUE);
  }));
  return $this->getTransitions($transition_ids);
}

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