You are here

public static function MigrateUpgradeImportBatch::onIdMapMessage in Drupal 8

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()

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 351

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';
  }
  $source_id_string = implode(',', $event
    ->getSourceIdValues());
  $message = t('Source ID @source_id: @message', [
    '@source_id' => $source_id_string,
    '@message' => $event
      ->getMessage(),
  ]);
  static::$messages
    ->display($message, $type);
}