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",
20 * source_module = "date",
21 * destination_module = "datetime"
24 * @deprecated in Drupal 8.4.x, to be removed before Drupal 9.0.x. Use
25 * \Drupal\datetime\Plugin\migrate\field\DateField instead.
27 class DateField extends FieldPluginBase {
32 public function getFieldWidgetMap() {
34 'date' => 'datetime_default',
35 'datetime' => 'datetime_default',
36 'datestamp' => 'datetime_timestamp',
43 public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
44 switch ($data['type']) {
46 $from_format = 'Y-m-d\TH:i:s';
47 $to_format = 'Y-m-d\TH:i:s';
54 $from_format = 'Y-m-d H:i:s';
55 $to_format = 'Y-m-d\TH:i:s';
58 throw new MigrateException(sprintf('Field %s of type %s is an unknown date field type.', $field_name, var_export($data['type'], TRUE)));
62 'plugin' => 'format_date',
63 'from_format' => $from_format,
64 'to_format' => $to_format,
70 'plugin' => 'sub_process',
71 'source' => $field_name,
72 'process' => $process,
74 $migration->mergeProcessOfProperty($field_name, $process);