3 namespace Drupal\datetime\Plugin\migrate\field\d6;
5 @trigger_error('DateField is deprecated in Drupal 8.4.x and will be removed before Drupal 9.0.x. Use \Drupal\datetime\Plugin\migrate\field\DateField instead.', E_USER_DEPRECATED);
7 use Drupal\migrate\Plugin\MigrationInterface;
8 use Drupal\migrate\MigrateException;
9 use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
15 * "date" = "datetime",
16 * "datestamp" = "timestamp",
17 * "datetime" = "datetime",
22 * @deprecated in Drupal 8.4.x, to be removed before Drupal 9.0.x. Use
23 * \Drupal\datetime\Plugin\migrate\field\DateField instead.
25 class DateField extends FieldPluginBase {
30 public function getFieldWidgetMap() {
32 'date' => 'datetime_default',
33 'datetime' => 'datetime_default',
34 'datestamp' => 'datetime_timestamp',
41 public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
42 switch ($data['type']) {
44 $from_format = 'Y-m-d\TH:i:s';
45 $to_format = 'Y-m-d\TH:i:s';
52 $from_format = 'Y-m-d H:i:s';
53 $to_format = 'Y-m-d\TH:i:s';
56 throw new MigrateException(sprintf('Field %s of type %s is an unknown date field type.', $field_name, var_export($data['type'], TRUE)));
60 'plugin' => 'format_date',
61 'from_format' => $from_format,
62 'to_format' => $to_format,
68 'plugin' => 'sub_process',
69 'source' => $field_name,
70 'process' => $process,
72 $migration->mergeProcessOfProperty($field_name, $process);