1<?php
2
3namespace Drupal\migrate_drupal\Annotation;
4
5use Drupal\Component\Annotation\Plugin;
6
7/**
8 * Defines a field plugin annotation object.
9 *
10 * Field plugins are responsible for handling the migration of custom fields
11 * (provided by Field API in Drupal 7) to Drupal 8. They are allowed to alter
12 * fieldable entity migrations when these migrations are being generated, and
13 * can compute destination field types for individual fields during the actual
14 * migration process.
15 *
16 * Plugin Namespace: Plugin\migrate\field
17 *
18 * @Annotation
19 */
20class MigrateField extends Plugin {
21
22  /**
23   * {@inheritdoc}
24   */
25  public function __construct($values) {
26    parent::__construct($values);
27    // Provide default value for core property, in case it's missing.
28    if (empty($this->definition['core'])) {
29      $this->definition['core'] = [6];
30    }
31  }
32
33  /**
34   * The plugin ID.
35   *
36   * @var string
37   */
38  public $id;
39
40  /**
41   * Map of D6 and D7 field types to D8 field type plugin IDs.
42   *
43   * @var string[]
44   */
45  public $type_map = [];
46
47  /**
48   * The Drupal core version(s) this plugin applies to.
49   *
50   * @var int[]
51   */
52  public $core;
53
54  /**
55   * Identifies the system providing the data the field plugin will read.
56   *
57   * The source_module is expected to be the name of a Drupal module that must
58   * be installed in the source database.
59   *
60   * @var string
61   */
62  public $source_module;
63
64  /**
65   * Identifies the system handling the data the destination plugin will write.
66   *
67   * The destination_module is expected to be the name of a Drupal module on the
68   * destination site that must be installed.
69   *
70   * @var string
71   */
72  public $destination_module;
73
74  /**
75   * The weight of this plugin relative to other plugins.
76   *
77   * The weight of this plugin relative to other plugins servicing the same
78   * field type and core version.  The lowest weighted applicable plugin will be
79   * used for each field.
80   *
81   * @var int
82   */
83  public $weight = 0;
84
85}
86