Version 1
[yaffs-website] / web / core / modules / system / src / Plugin / migrate / source / Menu.php
diff --git a/web/core/modules/system/src/Plugin/migrate/source/Menu.php b/web/core/modules/system/src/Plugin/migrate/source/Menu.php
new file mode 100644 (file)
index 0000000..c55bc4b
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+namespace Drupal\system\Plugin\migrate\source;
+
+use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
+
+/**
+ * Menu source from database.
+ *
+ * @MigrateSource(
+ *   id = "menu",
+ *   source_provider = "menu"
+ * )
+ */
+class Menu extends DrupalSqlBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function query() {
+    return $this->select('menu_custom', 'm')->fields('m');
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function fields() {
+    return [
+      'menu_name' => $this->t('The menu name. Primary key.'),
+      'title' => $this->t('The human-readable name of the menu.'),
+      'description' => $this->t('A description of the menu'),
+    ];
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getIds() {
+    $ids['menu_name']['type'] = 'string';
+    return $ids;
+  }
+
+}