diff --git a/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php b/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php index 95f0bb4..4ebdef3 100644 --- a/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php +++ b/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php @@ -9,12 +9,19 @@ use Drupal\migrate\Row; /** - * This plugin returns date storage formats from \DateTime::createFromFormat. + * This plugin applies date storage formats from \DateTime::createFromFormat. * * @MigrateProcessPlugin( * id = "format_date" * ) * + * Available configuration keys + * - from_format: the source format string as accepted by date() + * http://php.net/manual/en/function.date.php + * - to_format: the format string as accepted by date() to apply on source. + * - timezone: @see Drupal\Component\Datetime\DateTimePlus::__construct() + * - settings: @see Drupal\Component\Datetime\DateTimePlus::__construct() + * * Example usage for date only fields (DATETIME_DATE_STORAGE_FORMAT): * @code * process: @@ -66,7 +73,8 @@ public function transform($value, MigrateExecutableInterface $migrate_executable // https://www.drupal.org/node/2830079 try { $transformed = DateTimePlus::createFromFormat($fromFormat, $value, $timezone, $settings)->format($toFormat); - } catch (\Exception $e) { + } + catch (\Exception $e) { throw new MigrateException(sprintf('Format date plugin could not transform "%s" using the format "%s".', $value, $fromFormat)); }