You are here

protected function WorkflowTypeBase::getTransitionIdFromStateToState in Drupal 10

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

Gets the transition ID from state to state.

Parameters

string $from_state_id: The state ID to transition from.

string $to_state_id: The state ID to transition to.

Return value

string|null The transition ID, or NULL if no transition exists.

File

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

Class

WorkflowTypeBase
A base class for Workflow type plugins.

Namespace

Drupal\workflows\Plugin

Code

protected function getTransitionIdFromStateToState($from_state_id, $to_state_id) {
  foreach ($this->configuration['transitions'] as $transition_id => $transition) {
    if (in_array($from_state_id, $transition['from'], TRUE) && $transition['to'] === $to_state_id) {
      return $transition_id;
    }
  }
  return NULL;
}