You are here

protected function WorkflowCollector::mapStates in Workbench Moderation to Content Moderation 8.2

Generates Content Moderation-compatible moderation state definitions.

Parameters

string[] $states: The moderation state entity IDs.

Return value

array The Content Moderation-compatible moderation state definitions.

1 call to WorkflowCollector::mapStates()
WorkflowCollector::getWorkflows in src/WorkflowCollector.php
Returns all unique content type workflows.

File

src/WorkflowCollector.php, line 103

Class

WorkflowCollector

Namespace

Drupal\wbm2cm

Code

protected function mapStates(array $states) {
  $weight = 1;
  $map = function (ModerationStateInterface $state) use (&$weight) {
    return [
      'label' => $state
        ->label(),
      'published' => $state
        ->isPublishedState(),
      'default_revision' => $state
        ->isDefaultRevisionState(),
      'weight' => $weight++,
    ];
  };
  return array_map($map, $this->stateStorage
    ->loadMultiple($states));
}