You are here

public function MigrateManager::saveWorkbenchModerationStatesAndTransitions in Workbench Moderation to Content Moderation 8

Save the Workbench Moderation states and transitions.

File

src/MigrateManager.php, line 179

Class

MigrateManager
Manages migrating from WBM to CM.

Namespace

Drupal\wbm2cm

Code

public function saveWorkbenchModerationStatesAndTransitions() {

  // Collect all states.
  $states = [];
  foreach ($this->configFactory
    ->listAll('workbench_moderation.moderation_state.') as $state_ids) {
    $state = $this->configFactory
      ->getEditable($state_ids);
    $states[] = $state
      ->get();
  }
  $this->logger
    ->info('Found Workbench Moderation states: %state_ids', [
    '%state_ids' => print_r($states, 1),
  ]);

  // Save states.
  $this->migrateStore
    ->set('states', $states);

  // Collect all transitions.
  $transitions = [];
  foreach ($this->configFactory
    ->listAll('workbench_moderation.moderation_state_transition.') as $transition_ids) {
    $transition = $this->configFactory
      ->getEditable($transition_ids);
    $transitions[] = $transition
      ->get();
  }
  $this->logger
    ->info('Found Workbench Moderation transitions: %transition_ids', [
    '%transition_ids' => print_r($transitions, 1),
  ]);

  // Save transitions.
  $this->migrateStore
    ->set('transitions', $transitions);
}