Browse Source

Added paragraph source.

Frederic G. MARAND 7 years ago
parent
commit
4e49443e6d
1 changed files with 49 additions and 0 deletions
  1. 49 0
      src/Plugin/migrate/source/ReinstallParagraphSource.php

+ 49 - 0
src/Plugin/migrate/source/ReinstallParagraphSource.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace Drupal\reinstall\Plugin\migrate\source;
+
+use Drupal\Core\Entity\EntityFieldManagerInterface;
+use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
+use Drupal\migrate\Plugin\MigrationInterface;
+
+/**
+ * Source plugin for terms from a YAML file.
+ *
+ * @MigrateSource(
+ *   id = "reinstall_paragraphs"
+ * )
+ */
+class ReinstallNodeSource extends SimpleSource {
+  const ENTITY_TYPE = 'node';
+
+  /**
+   * Constructor.
+   */
+  public function __construct(
+    array $configuration,
+    string $pluginId,
+    array $pluginDefinition,
+    MigrationInterface $migration,
+    EntityTypeBundleInfoInterface $ebi,
+    EntityFieldManagerInterface $efm
+  ) {
+    parent::__construct($configuration, $pluginId, $pluginDefinition, $migration, $ebi, $efm);
+
+    $rawRecords = array_map([$this, 'flattenRecord'], $this->initialParse($configuration));
+    $this->records = $rawRecords;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getIds() {
+    $ids = [
+      'nid' => [
+        'type' => 'integer',
+      ],
+    ];
+
+    return $ids;
+  }
+
+}