summaryrefslogtreecommitdiffstats
path: root/core/modules/migrate_drupal
diff options
context:
space:
mode:
authorGabor Hojtsy2017-10-31 19:53:31 (GMT)
committerGabor Hojtsy2017-10-31 19:53:31 (GMT)
commit61df34e0663ba501d09b0da5839472f6cb60049e (patch)
treef0d07fd11a2648137ffd21bf6dbb82e1ed9472db /core/modules/migrate_drupal
parent8d2a2ec23022f4f950af05ba9aef22f6c782906e (diff)
Issue #2859304 by quietone, heddn, Jo Fitzgerald, maxocub, rivimey, phenaproxima, jhodgdon: Show field type migrations correctly in Migrate Drupal UI
Diffstat (limited to 'core/modules/migrate_drupal')
-rw-r--r--core/modules/migrate_drupal/src/Annotation/MigrateField.php22
-rw-r--r--core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php14
-rw-r--r--core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php2
-rw-r--r--core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php2
-rw-r--r--core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6FileField.php4
-rw-r--r--core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6NoCoreVersionSpecified.php4
-rw-r--r--core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6FileField.php4
-rw-r--r--core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6NoCoreVersionSpecified.php9
8 files changed, 52 insertions, 9 deletions
diff --git a/core/modules/migrate_drupal/src/Annotation/MigrateField.php b/core/modules/migrate_drupal/src/Annotation/MigrateField.php
index ad78bc9..8225b71 100644
--- a/core/modules/migrate_drupal/src/Annotation/MigrateField.php
+++ b/core/modules/migrate_drupal/src/Annotation/MigrateField.php
@@ -49,6 +49,26 @@ class MigrateField extends Plugin {
*
* @var int[]
*/
- public $core = [];
+ 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
+ * 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;
}
diff --git a/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php b/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php
index 2b33c85..7a9c479 100644
--- a/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php
+++ b/core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php
@@ -3,6 +3,7 @@
namespace Drupal\migrate_drupal\Plugin;
use Drupal\Component\Plugin\Exception\PluginNotFoundException;
+use Drupal\migrate\Plugin\Exception\BadPluginDefinitionException;
use Drupal\migrate\Plugin\MigratePluginManager;
use Drupal\migrate\Plugin\MigrationInterface;
@@ -53,4 +54,17 @@ class MigrateFieldPluginManager extends MigratePluginManager implements MigrateF
throw new PluginNotFoundException($field_type);
}
+ /**
+ * {@inheritdoc}
+ */
+ public function processDefinition(&$definition, $plugin_id) {
+ parent::processDefinition($definition, $plugin_id);
+
+ foreach (['core', 'source_module', 'destination_module'] as $required_property) {
+ if (empty($definition[$required_property])) {
+ throw new BadPluginDefinitionException($plugin_id, $required_property);
+ }
+ }
+ }
+
}
diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php b/core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php
index 1579afa..ba69b78 100644
--- a/core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php
@@ -11,6 +11,8 @@ use Drupal\migrate\Plugin\MigrationInterface;
* type_map = {
* "nodereference" = "entity_reference",
* },
+ * source_module = "node_reference",
+ * destination_module = "core",
* )
*/
class NodeReference extends FieldPluginBase {
diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php b/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php
index 11df8ec..0c8e9ba 100644
--- a/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php
@@ -11,6 +11,8 @@ use Drupal\migrate\Plugin\MigrationInterface;
* type_map = {
* "userreference" = "entity_reference",
* },
+ * source_module = "user_reference",
+ * destination_module = "core",
* )
*/
class UserReference extends FieldPluginBase {
diff --git a/core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6FileField.php b/core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6FileField.php
index 1b43724..f8a89da 100644
--- a/core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6FileField.php
+++ b/core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6FileField.php
@@ -11,7 +11,9 @@ use Drupal\migrate\Plugin\MigrationInterface;
* core = {6},
* type_map = {
* "file" = "file"
- * }
+ * },
+ * source_module = "foo",
+ * destination_module = "bar"
* )
*/
class D6FileField extends CckFieldPluginBase {
diff --git a/core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6NoCoreVersionSpecified.php b/core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6NoCoreVersionSpecified.php
index 74dfd3b..34bed95 100644
--- a/core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6NoCoreVersionSpecified.php
+++ b/core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6NoCoreVersionSpecified.php
@@ -7,7 +7,9 @@ use Drupal\migrate\Plugin\MigrationInterface;
/**
* @MigrateCckField(
- * id = "d6_no_core_version_specified"
+ * id = "d6_no_core_version_specified",
+ * source_module = "foo",
+ * destination_module = "bar",
* )
*/
class D6NoCoreVersionSpecified extends CckFieldPluginBase {
diff --git a/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6FileField.php b/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6FileField.php
index acb9d9c..de55e13 100644
--- a/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6FileField.php
+++ b/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6FileField.php
@@ -10,7 +10,9 @@ use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
* core = {6},
* type_map = {
* "file" = "file"
- * }
+ * },
+ * source_module = "foo",
+ * destination_module = "bar"
* )
*/
class D6FileField extends FieldPluginBase {}
diff --git a/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6NoCoreVersionSpecified.php b/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6NoCoreVersionSpecified.php
index 39f109b..e7647a1 100644
--- a/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6NoCoreVersionSpecified.php
+++ b/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6NoCoreVersionSpecified.php
@@ -6,10 +6,9 @@ use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
/**
* @MigrateField(
- * id = "d6_no_core_version_specified"
+ * id = "d6_no_core_version_specified",
+ * source_module = "foo",
+ * destination_module = "bar",
* )
*/
-class D6NoCoreVersionSpecified extends FieldPluginBase {
-
-
-}
+class D6NoCoreVersionSpecified extends FieldPluginBase {}