function MigrateMessageController::overview
Same name in this branch
- 10 core/modules/migrate_drupal_ui/src/Controller/MigrateMessageController.php \Drupal\migrate_drupal_ui\Controller\MigrateMessageController::overview()
Same name in other branches
- 11.x core/modules/migrate/src/Controller/MigrateMessageController.php \Drupal\migrate\Controller\MigrateMessageController::overview()
- 11.x core/modules/migrate_drupal_ui/src/Controller/MigrateMessageController.php \Drupal\migrate_drupal_ui\Controller\MigrateMessageController::overview()
Displays an overview of migrate messages.
Return value
array A render array as expected by \Drupal\Core\Render\RendererInterface::render().
1 call to MigrateMessageController::overview()
- MigrateMessageController::overview in core/
modules/ migrate_drupal_ui/ src/ Controller/ MigrateMessageController.php - Displays an overview of migrate messages.
1 string reference to 'MigrateMessageController::overview'
- migrate.routing.yml in core/
modules/ migrate/ migrate.routing.yml - core/modules/migrate/migrate.routing.yml
1 method overrides MigrateMessageController::overview()
- MigrateMessageController::overview in core/
modules/ migrate_drupal_ui/ src/ Controller/ MigrateMessageController.php - Displays an overview of migrate messages.
File
-
core/
modules/ migrate/ src/ Controller/ MigrateMessageController.php, line 50
Class
- MigrateMessageController
- Provides controller methods for the Message form.
Namespace
Drupal\migrate\ControllerCode
public function overview() : array {
// Check if there are migrate_message tables.
$tables = $this->database
->schema()
->findTables('migrate_message_%');
if (empty($tables)) {
$build['no_tables'] = [
'#type' => 'item',
'#markup' => $this->t('There are no migration message tables.'),
];
return $build;
}
// There are migrate_message tables so build the overview form.
$migrations = $this->migrationPluginManager
->createInstances([]);
$header = [
$this->t('Migration'),
$this->t('Machine Name'),
$this->t('Messages'),
];
// Display the number of messages for each migration.
$rows = [];
foreach ($migrations as $id => $migration) {
$message_count = $migration->getIdMap()
->messageCount();
// The message count is zero when there are no messages or when the
// message table does not exist.
if ($message_count == 0) {
continue;
}
$row = [];
$row['label'] = $migration->label();
$row['machine_name'] = $id;
$route_parameters = [
'migration_id' => $migration->id(),
];
$row['messages'] = [
'data' => [
'#type' => 'link',
'#title' => $message_count,
'#url' => Url::fromRoute('migrate.messages.detail', $route_parameters),
],
];
$rows[] = $row;
}
$build['migrations_table'] = [
'#type' => 'table',
'#header' => $header,
'#rows' => $rows,
'#empty' => $this->t('No migration messages available.'),
];
$build['message_pager'] = [
'#type' => 'pager',
];
return $build;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.