function WorkflowTypeBase::getStates

Gets state objects for the provided state IDs.

Parameters

string[] $state_ids: A list of state IDs to get. If NULL then all states will be returned.

Return value

\Drupal\workflows\StateInterface[] An array of workflow states, keyed by state IDs.

Overrides WorkflowTypeInterface::getStates

1 call to WorkflowTypeBase::getStates()
WorkflowTypeBase::getInitialState in core/modules/workflows/src/Plugin/WorkflowTypeBase.php
Gets the initial state for the workflow.
1 method overrides WorkflowTypeBase::getStates()
PredefinedStatesWorkflowTestType::getStates in core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/PredefinedStatesWorkflowTestType.php
Gets state objects for the provided state IDs.

File

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

Class

WorkflowTypeBase
A base class for Workflow type plugins.

Namespace

Drupal\workflows\Plugin

Code

public function getStates($state_ids = NULL) {
  if ($state_ids === NULL) {
    $state_ids = array_keys($this->configuration['states']);
  }
  /** @var \Drupal\workflows\StateInterface[] $states */
  $states = array_combine($state_ids, array_map([
    $this,
    'getState',
  ], $state_ids));
  return static::labelWeightMultisort($states);
}

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