You are here

public static function WorkflowState::loadMultiple in Workflow 8

Get all states in the system, with options to filter, only where a workflow exists.

@_deprecated WorkflowState::getStates() ==> WorkflowState::loadMultiple()

Parameters

array $ids: An array of State IDs, or NULL to load all states.

string $wid: The requested Workflow ID.

bool $reset: An option to refresh all caches.

Return value

WorkflowState[] An array of cached states, keyed by state_id.

Overrides EntityBase::loadMultiple

4 calls to WorkflowState::loadMultiple()
Workflow::getStates in src/Entity/Workflow.php
Gets all states for a given workflow.
WorkflowCleanupSettingsForm::buildForm in modules/workflow_cleanup/src/Form/WorkflowCleanupSettingsForm.php
@inheritdoc
WorkflowItem::storageSettingsForm in src/Plugin/Field/FieldType/WorkflowItem.php
Implements hook_field_settings_form() -> ConfigFieldItemInterface::settingsForm().
WorkflowState::deactivate in src/Entity/WorkflowState.php
Deactivate a Workflow State, moving existing content to a given State.

File

src/Entity/WorkflowState.php, line 205

Class

WorkflowState
Workflow configuration entity to persistently store configuration.

Namespace

Drupal\workflow\Entity

Code

public static function loadMultiple(array $ids = NULL, $wid = '', $reset = FALSE) {
  $states = parent::loadMultiple();
  usort($states, [
    'Drupal\\workflow\\Entity\\WorkflowState',
    'sort',
  ]);

  // Filter on Wid, if requested, E.g., by Workflow->getStates().
  // Set the ID as array key.
  $result = [];
  foreach ($states as $state) {

    /** @var  WorkflowState $state */
    if (!$wid || $wid == $state
      ->getWorkflowId()) {
      $result[$state
        ->id()] = $state;
    }
  }
  return $result;
}