summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/migrate_drupal/src/Annotation/MigrateField.php
blob: 03a4e6c35950752b3d13f81bb40397058c785103 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php

namespace Drupal\migrate_drupal\Annotation;

use Drupal\Component\Annotation\Plugin;

/**
 * Defines a field plugin annotation object.
 *
 * Field plugins are responsible for handling the migration of custom fields
 * (provided by Field API in Drupal 7) to Drupal 8. They are allowed to alter
 * fieldable entity migrations when these migrations are being generated, and
 * can compute destination field types for individual fields during the actual
 * migration process.
 *
 * Plugin Namespace: Plugin\migrate\field
 *
 * @Annotation
 */
class MigrateField extends Plugin {

  /**
   * {@inheritdoc}
   */
  public function __construct($values) {
    parent::__construct($values);
    // Provide default value for core property, in case it's missing.
    if (empty($this->definition['core'])) {
      $this->definition['core'] = [6];
    }
  }

  /**
   * The plugin ID.
   *
   * @var string
   */
  public $id;

  /**
   * Map of D6 and D7 field types to D8 field type plugin IDs.
   *
   * @var string[]
   */
  public $type_map = [];

  /**
   * The Drupal core version(s) this plugin applies to.
   *
   * @var int[]
   */
  public $core;

  /**
   * Identifies the system providing the data the field plugin will read.
   *
   * The source_module is expected to be the name of a Drupal module that must
   * be installed in the source database.
   *
   * @var string
   */
  public $source_module;

  /**
   * Identifies the system handling the data the destination plugin will write.
   *
   * The destination_module is expected to be the name of a Drupal module on the
   * destination site that must be installed.
   *
   * @var string
   */
  public $destination_module;

  /**
   * The weight of this plugin relative to other plugins.
   *
   * The weight of this plugin relative to other plugins servicing the same
   * field type and core version.  The lowest weighted applicable plugin will be
   * used for each field.
   *
   * @var int
   */
  public $weight = 0;

}