Пример #1
0
 /**
  * Reacts to map message event.
  *
  * @param \Drupal\Migrate\Event\MigrateIdMapMessageEvent $event
  *   The migration event.
  * @param string $name
  *   The event name.
  */
 public function mapMessageRecorder(MigrateIdMapMessageEvent $event, $name)
 {
     if ($event->getLevel() == MigrationInterface::MESSAGE_NOTICE || $event->getLevel() == MigrationInterface::MESSAGE_INFORMATIONAL) {
         $type = 'status';
     } else {
         $type = 'error';
     }
     $source_id_string = implode(',', $event->getSourceIdValues());
     $this->display($source_id_string . ': ' . $event->getMessage(), $type);
 }
Пример #2
0
 /**
  * Displays any messages being logged to the ID map.
  *
  * @param \Drupal\migrate\Event\MigrateIdMapMessageEvent $event
  *   The message event.
  */
 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 = new TranslatableMarkup('Source ID @source_id: @message', ['@source_id' => $source_id_string, '@message' => $event->getMessage()]);
     static::$messages->display($message, $type);
 }