summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2017-08-18 11:55:01 +0900
committerNathaniel Catchpole2017-08-18 11:55:08 +0900
commit93b23b76eeb1ea834f303042a3a399d968907c27 (patch)
tree8589d955e2f6db412cf6b724da4706fff6d74473
parentc76ec5fc4bbfa6187ce860bf7f6e2fddf51958c9 (diff)
Issue #2896507 by heddn, maxocub: Update FieldPluginBase with a default processFieldValues() and getFieldFormatterMap()
(cherry picked from commit a47d8c49b2da7155b8b3680c0b7bb4a009029211)
-rw-r--r--core/modules/datetime/src/Plugin/migrate/field/DateField.php9
-rw-r--r--core/modules/datetime/src/Plugin/migrate/field/d6/DateField.php9
-rw-r--r--core/modules/file/src/Plugin/migrate/cckfield/d7/ImageField.php7
-rw-r--r--core/modules/migrate_drupal/src/Plugin/migrate/field/FieldPluginBase.php18
-rw-r--r--core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php7
-rw-r--r--core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php7
-rw-r--r--core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6FileField.php5
-rw-r--r--core/modules/migrate_drupal/tests/modules/migrate_cckfield_plugin_manager_test/src/Plugin/migrate/cckfield/D6NoCoreVersionSpecified.php5
-rw-r--r--core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/cckfield/d6/FileField.php7
-rw-r--r--core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6FileField.php17
-rw-r--r--core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/field/D6NoCoreVersionSpecified.php12
-rw-r--r--core/modules/taxonomy/src/Plugin/migrate/cckfield/TaxonomyTermReference.php7
12 files changed, 19 insertions, 91 deletions
diff --git a/core/modules/datetime/src/Plugin/migrate/field/DateField.php b/core/modules/datetime/src/Plugin/migrate/field/DateField.php
index 3a61a78..0dd56c9 100644
--- a/core/modules/datetime/src/Plugin/migrate/field/DateField.php
+++ b/core/modules/datetime/src/Plugin/migrate/field/DateField.php
@@ -33,15 +33,6 @@ class DateField extends FieldPluginBase {
/**
* {@inheritdoc}
*/
- public function getFieldFormatterMap() {
- // See d6_field_formatter_settings.yml, d7_field_formatter_settings.yml and
- // FieldPluginBase::processFieldFormatter().
- return [];
- }
-
- /**
- * {@inheritdoc}
- */
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
switch ($data['type']) {
case 'date':
diff --git a/core/modules/datetime/src/Plugin/migrate/field/d6/DateField.php b/core/modules/datetime/src/Plugin/migrate/field/d6/DateField.php
index a2429f6..c4e7b49 100644
--- a/core/modules/datetime/src/Plugin/migrate/field/d6/DateField.php
+++ b/core/modules/datetime/src/Plugin/migrate/field/d6/DateField.php
@@ -38,15 +38,6 @@ class DateField extends FieldPluginBase {
/**
* {@inheritdoc}
*/
- public function getFieldFormatterMap() {
- // See d6_field_formatter_settings.yml and
- // FieldPluginBase::processFieldFormatter().
- return [];
- }
-
- /**
- * {@inheritdoc}
- */
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
switch ($data['type']) {
case 'date':
diff --git a/core/modules/file/src/Plugin/migrate/cckfield/d7/ImageField.php b/core/modules/file/src/Plugin/migrate/cckfield/d7/ImageField.php
index ad24ae2..2b34a80 100644
--- a/core/modules/file/src/Plugin/migrate/cckfield/d7/ImageField.php
+++ b/core/modules/file/src/Plugin/migrate/cckfield/d7/ImageField.php
@@ -16,13 +16,6 @@ class ImageField extends CckFieldPluginBase {
/**
* {@inheritdoc}
*/
- public function getFieldFormatterMap() {
- return [];
- }
-
- /**
- * {@inheritdoc}
- */
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'iterator',
diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/field/FieldPluginBase.php b/core/modules/migrate_drupal/src/Plugin/migrate/field/FieldPluginBase.php
index 852c6ca..027276c 100644
--- a/core/modules/migrate_drupal/src/Plugin/migrate/field/FieldPluginBase.php
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/field/FieldPluginBase.php
@@ -48,6 +48,13 @@ abstract class FieldPluginBase extends PluginBase implements MigrateFieldInterfa
/**
* {@inheritdoc}
*/
+ public function getFieldFormatterMap() {
+ return [];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function getFieldWidgetMap() {
// By default, use the plugin ID for the widget types.
return [
@@ -69,6 +76,17 @@ abstract class FieldPluginBase extends PluginBase implements MigrateFieldInterfa
/**
* {@inheritdoc}
*/
+ public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
+ $process = [
+ 'plugin' => 'get',
+ 'source' => $field_name,
+ ];
+ $migration->mergeProcessOfProperty($field_name, $process);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function getFieldType(Row $row) {
$field_type = $row->getSourceProperty('type');
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 2f6f099..1579afa 100644
--- a/core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/field/NodeReference.php
@@ -18,13 +18,6 @@ class NodeReference extends FieldPluginBase {
/**
* {@inheritdoc}
*/
- public function getFieldFormatterMap() {
- return [];
- }
-
- /**
- * {@inheritdoc}
- */
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'iterator',
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 4f1a603..11df8ec 100644
--- a/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php
+++ b/core/modules/migrate_drupal/src/Plugin/migrate/field/UserReference.php
@@ -18,13 +18,6 @@ class UserReference extends FieldPluginBase {
/**
* {@inheritdoc}
*/
- public function getFieldFormatterMap() {
- return [];
- }
-
- /**
- * {@inheritdoc}
- */
public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'iterator',
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 529907a..3f39759 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
@@ -19,11 +19,6 @@ class D6FileField extends CckFieldPluginBase {
/**
* {@inheritdoc}
*/
- public function getFieldFormatterMap() {}
-
- /**
- * {@inheritdoc}
- */
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {}
}
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 16967db..74dfd3b 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
@@ -15,11 +15,6 @@ class D6NoCoreVersionSpecified extends CckFieldPluginBase {
/**
* {@inheritdoc}
*/
- public function getFieldFormatterMap() {}
-
- /**
- * {@inheritdoc}
- */
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {}
}
diff --git a/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/cckfield/d6/FileField.php b/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/cckfield/d6/FileField.php
index 903c7e8..2ba83cb 100644
--- a/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/cckfield/d6/FileField.php
+++ b/core/modules/migrate_drupal/tests/modules/migrate_field_plugin_manager_test/src/Plugin/migrate/cckfield/d6/FileField.php
@@ -16,13 +16,6 @@ class FileField extends CckFieldPluginBase {
/**
* {@inheritdoc}
*/
- public function getFieldFormatterMap() {
- return [];
- }
-
- /**
- * {@inheritdoc}
- */
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
$migration->mergeProcessOfProperty($field_name, [
'class' => __CLASS__,
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 08ca88c..acb9d9c 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
@@ -3,7 +3,6 @@
namespace Drupal\migrate_field_plugin_manager_test\Plugin\migrate\field;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
-use Drupal\migrate\Plugin\MigrationInterface;
/**
* @MigrateField(
@@ -14,18 +13,4 @@ use Drupal\migrate\Plugin\MigrationInterface;
* }
* )
*/
-class D6FileField extends FieldPluginBase {
-
- /**
- * {@inheritdoc}
- */
- public function getFieldFormatterMap() {
- return [];
- }
-
- /**
- * {@inheritdoc}
- */
- public function processFieldValues(MigrationInterface $migration, $field_name, $data) {}
-
-}
+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 224388b..39f109b 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
@@ -3,7 +3,6 @@
namespace Drupal\migrate_field_plugin_manager_test\Plugin\migrate\field;
use Drupal\migrate_drupal\Plugin\migrate\field\FieldPluginBase;
-use Drupal\migrate\Plugin\MigrationInterface;
/**
* @MigrateField(
@@ -12,16 +11,5 @@ use Drupal\migrate\Plugin\MigrationInterface;
*/
class D6NoCoreVersionSpecified extends FieldPluginBase {
- /**
- * {@inheritdoc}
- */
- public function getFieldFormatterMap() {
- return [];
- }
-
- /**
- * {@inheritdoc}
- */
- public function processFieldValues(MigrationInterface $migration, $field_name, $data) {}
}
diff --git a/core/modules/taxonomy/src/Plugin/migrate/cckfield/TaxonomyTermReference.php b/core/modules/taxonomy/src/Plugin/migrate/cckfield/TaxonomyTermReference.php
index 2d4e719..886eb84 100644
--- a/core/modules/taxonomy/src/Plugin/migrate/cckfield/TaxonomyTermReference.php
+++ b/core/modules/taxonomy/src/Plugin/migrate/cckfield/TaxonomyTermReference.php
@@ -19,13 +19,6 @@ class TaxonomyTermReference extends CckFieldPluginBase {
/**
* {@inheritdoc}
*/
- public function getFieldFormatterMap() {
- return [];
- }
-
- /**
- * {@inheritdoc}
- */
public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
$process = [
'plugin' => 'iterator',