Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / migrate_drupal / src / Plugin / migrate / field / FieldPluginBase.php
index 852c6ca6ff4b9de942827f41743be0951aac4346..dc115abc99f6dd87dd8974e489f95ffa5dbc2b50 100644 (file)
@@ -45,6 +45,27 @@ abstract class FieldPluginBase extends PluginBase implements MigrateFieldInterfa
     $migration->mergeProcessOfProperty('options/type', $process);
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function getFieldFormatterType(Row $row) {
+    return $row->getSourceProperty('formatter/type');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFieldFormatterMap() {
+    return [];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFieldWidgetType(Row $row) {
+    return $row->getSourceProperty('widget/type');
+  }
+
   /**
    * {@inheritdoc}
    */
@@ -60,12 +81,28 @@ abstract class FieldPluginBase extends PluginBase implements MigrateFieldInterfa
    */
   public function processFieldFormatter(MigrationInterface $migration) {
     $process = [];
+
+    // Some migrate field plugin IDs are prefixed with 'd6_' or 'd7_'. Since the
+    // plugin ID is used in the static map as the module name, we have to remove
+    // this prefix from the plugin ID.
+    $plugin_id = preg_replace('/d[67]_/', '', $this->pluginId);
     foreach ($this->getFieldFormatterMap() as $source_format => $destination_format) {
-      $process[0]['map'][$this->pluginId][$source_format] = $destination_format;
+      $process[0]['map'][$plugin_id][$source_format] = $destination_format;
     }
     $migration->mergeProcessOfProperty('options/type', $process);
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function processFieldValues(MigrationInterface $migration, $field_name, $data) {
+    $process = [
+      'plugin' => 'get',
+      'source' => $field_name,
+    ];
+    $migration->mergeProcessOfProperty($field_name, $process);
+  }
+
   /**
    * {@inheritdoc}
    */