function MigrateUpgradeImportBatch::onIdMapMessage

Same name and namespace in other branches
  1. 9 core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php \Drupal\migrate_drupal_ui\Batch\MigrateUpgradeImportBatch::onIdMapMessage()
  2. 8.9.x core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php \Drupal\migrate_drupal_ui\Batch\MigrateUpgradeImportBatch::onIdMapMessage()
  3. 11.x core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php \Drupal\migrate_drupal_ui\Batch\MigrateUpgradeImportBatch::onIdMapMessage()

Displays any messages being logged to the ID map.

Parameters

\Drupal\migrate\Event\MigrateIdMapMessageEvent $event: The message event.

File

core/modules/migrate_drupal_ui/src/Batch/MigrateUpgradeImportBatch.php, line 360

Class

MigrateUpgradeImportBatch
Runs a single migration batch.

Namespace

Drupal\migrate_drupal_ui\Batch

Code

public static function onIdMapMessage(MigrateIdMapMessageEvent $event) {
  if ($event->getLevel() == MigrationInterface::MESSAGE_NOTICE || $event->getLevel() == MigrationInterface::MESSAGE_INFORMATIONAL) {
    $type = 'status';
  }
  else {
    $type = 'error';
  }
  $migration_id = $event->getMigration()
    ->getPluginId();
  $source_id_string = implode(',', $event->getSourceIdValues());
  $message = t('Migration @migration_id: Source ID @source_id: @message', [
    '@migration_id' => $migration_id,
    '@source_id' => $source_id_string,
    '@message' => $event->getMessage(),
  ]);
  static::$messages->display($message, $type);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.