Version 1
[yaffs-website] / web / core / modules / link / src / Plugin / migrate / field / d7 / LinkField.php
diff --git a/web/core/modules/link/src/Plugin/migrate/field/d7/LinkField.php b/web/core/modules/link/src/Plugin/migrate/field/d7/LinkField.php
new file mode 100644 (file)
index 0000000..4e78ee5
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+
+namespace Drupal\link\Plugin\migrate\field\d7;
+
+use Drupal\link\Plugin\migrate\field\d6\LinkField as D6LinkField;
+use Drupal\migrate\Plugin\MigrationInterface;
+
+/**
+ * @MigrateField(
+ *   id = "link_field",
+ *   core = {7},
+ *   type_map = {
+ *     "link_field" = "link"
+ *   }
+ * )
+ *
+ * This plugin provides the exact same functionality as the Drupal 6 "link"
+ * plugin with the exception that the plugin ID "link_field" is used in the
+ * field type map.
+ */
+class LinkField extends D6LinkField {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getFieldWidgetMap() {
+    // By default, use the plugin ID for the widget types.
+    return ['link_field' => 'link_default'];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function processFieldInstance(MigrationInterface $migration) {
+    $process = [
+      'plugin' => 'static_map',
+      'source' => 'instance_settings/title',
+      'bypass' => TRUE,
+      'map' => [
+        'disabled' => DRUPAL_DISABLED,
+        'optional' => DRUPAL_OPTIONAL,
+        'required' => DRUPAL_REQUIRED,
+      ],
+    ];
+    $migration->mergeProcessOfProperty('settings/title', $process);
+  }
+
+}