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