You are here

public function MigrationController::process in Migrate Tools 8.2

Same name and namespace in other branches
  1. 8.5 src/Controller/MigrationController.php \Drupal\migrate_tools\Controller\MigrationController::process()
  2. 8.3 src/Controller/MigrationController.php \Drupal\migrate_tools\Controller\MigrationController::process()
  3. 8.4 src/Controller/MigrationController.php \Drupal\migrate_tools\Controller\MigrationController::process()

Display process information of a migration entity.

Parameters

string $migration_group: Machine name of the migration's group.

string $migration: Machine name of the migration.

Return value

array A render array as expected by drupal_render().

1 string reference to 'MigrationController::process'
migrate_tools.routing.yml in ./migrate_tools.routing.yml
migrate_tools.routing.yml

File

src/Controller/MigrationController.php, line 159

Class

MigrationController
Returns responses for migrate_tools migration view routes.

Namespace

Drupal\migrate_tools\Controller

Code

public function process($migration_group, $migration) {

  /** @var MigrationInterface $migration */
  $migration = $this->migrationConfigEntityPluginManager
    ->createInstance($migration);

  // Process information.
  $build['process'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Process'),
  ];
  $header = [
    $this
      ->t('Destination'),
    $this
      ->t('Source'),
    $this
      ->t('Process plugin'),
    $this
      ->t('Default'),
  ];
  $rows = [];
  foreach ($migration
    ->getProcess() as $destination_id => $process_line) {
    $row = [];
    $row[] = [
      'data' => Html::escape($destination_id),
    ];
    if (isset($process_line[0]['source'])) {
      $row[] = [
        'data' => Xss::filterAdmin($process_line[0]['source']),
      ];
    }
    else {
      $row[] = '';
    }
    if (isset($process_line[0]['plugin'])) {
      $row[] = [
        'data' => Xss::filterAdmin($process_line[0]['plugin']),
      ];
    }
    else {
      $row[] = '';
    }
    if (isset($process_line[0]['default_value'])) {
      $row[] = [
        'data' => Xss::filterAdmin($process_line[0]['default_value']),
      ];
    }
    else {
      $row[] = '';
    }
    $rows[] = $row;
  }
  $build['process']['fields'] = [
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => $this
      ->t('No process defined.'),
  ];
  return $build;
}