You are here

public function MigrationController::overview in Migrate Tools 8.5

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

Displays an overview of a migration entity.

Parameters

\Drupal\migrate_plus\Entity\MigrationGroupInterface $migration_group: The migration group.

\Drupal\migrate_plus\Entity\MigrationInterface $migration: The $migration.

Return value

array A render array as expected by drupal_render().

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

File

src/Controller/MigrationController.php, line 71

Class

MigrationController
Returns responses for migrate_tools migration view routes.

Namespace

Drupal\migrate_tools\Controller

Code

public function overview(MigrationGroupInterface $migration_group, MigrationInterface $migration) {
  $build['overview'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Overview'),
  ];
  $build['overview']['group'] = [
    '#title' => $this
      ->t('Group:'),
    '#markup' => Xss::filterAdmin($migration_group
      ->label()),
    '#type' => 'item',
  ];
  $build['overview']['description'] = [
    '#title' => $this
      ->t('Description:'),
    '#markup' => Xss::filterAdmin($migration
      ->label()),
    '#type' => 'item',
  ];
  $migration_plugin = $this->migrationPluginManager
    ->createInstance($migration
    ->id(), $migration
    ->toArray());
  $migration_dependencies = $migration_plugin
    ->getMigrationDependencies();
  if (!empty($migration_dependencies['required'])) {
    $build['overview']['dependencies'] = [
      '#title' => $this
        ->t('Migration Dependencies'),
      '#markup' => Xss::filterAdmin(implode(', ', $migration_dependencies['required'])),
      '#type' => 'item',
    ];
  }
  if (!empty($migration_dependencies['optional'])) {
    $build['overview']['soft_dependencies'] = [
      '#title' => $this
        ->t('Soft Migration Dependencies'),
      '#markup' => Xss::filterAdmin(implode(', ', $migration_dependencies['optional'])),
      '#type' => 'item',
    ];
  }
  return $build;
}