public function MigrationListBuilder::buildRow in Migrate Tools 8
Same name and namespace in other branches
- 8.5 src/Controller/MigrationListBuilder.php \Drupal\migrate_tools\Controller\MigrationListBuilder::buildRow()
- 8.2 src/Controller/MigrationListBuilder.php \Drupal\migrate_tools\Controller\MigrationListBuilder::buildRow()
- 8.3 src/Controller/MigrationListBuilder.php \Drupal\migrate_tools\Controller\MigrationListBuilder::buildRow()
- 8.4 src/Controller/MigrationListBuilder.php \Drupal\migrate_tools\Controller\MigrationListBuilder::buildRow()
Builds a row for an entity in the entity listing.
Parameters
\Drupal\migrate\Entity\EntityInterface $migration: The entity for which to build the row.
Return value
array A render array of the table row for displaying the entity.
Overrides EntityListBuilder::buildRow
See also
Drupal\Core\Entity\EntityListController::render()
File
- src/
Controller/ MigrationListBuilder.php, line 90 - Contains Drupal\migrate_tools\Controller\MigrationListBuilder.
Class
- MigrationListBuilder
- Provides a listing of migration entities in a given group.
Namespace
Drupal\migrate_tools\ControllerCode
public function buildRow(EntityInterface $migration) {
$row['label'] = $migration
->label();
$row['machine_name'] = $migration
->id();
$row['status'] = $migration
->getStatusLabel();
// Derive the stats
$source_plugin = $migration
->getSourcePlugin();
$row['total'] = $source_plugin
->count();
$map = $migration
->getIdMap();
$row['imported'] = $map
->importedCount();
// -1 indicates uncountable sources.
if ($row['total'] == -1) {
$row['total'] = $this
->t('N/A');
$row['unprocessed'] = $this
->t('N/A');
}
else {
$row['unprocessed'] = $row['total'] - $map
->processedCount();
}
$migration_group = $migration
->getThirdPartySetting('migrate_plus', 'migration_group');
if (!$migration_group) {
$migration_group = 'default';
}
$route_parameters = array(
'migration_group' => $migration_group,
'migration' => $migration
->id(),
);
$row['messages'] = array(
'data' => array(
'#type' => 'link',
'#title' => $map
->messageCount(),
'#url' => Url::fromRoute("migrate_tools.messages", $route_parameters),
),
);
$migrate_last_imported_store = \Drupal::keyValue('migrate_last_imported');
$last_imported = $migrate_last_imported_store
->get($migration
->id(), FALSE);
if ($last_imported) {
/** @var DateFormatter $date_formatter */
$date_formatter = \Drupal::service('date.formatter');
$row['last_imported'] = $date_formatter
->format($last_imported / 1000, 'custom', 'Y-m-d H:i:s');
}
else {
$row['last_imported'] = '';
}
return $row;
// + parent::buildRow($migration);
}