ReinstallParagraphSource.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Drupal\reinstall\Plugin\migrate\source;
  3. use Drupal\Core\Entity\EntityFieldManagerInterface;
  4. use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
  5. use Drupal\migrate\Plugin\MigrationInterface;
  6. /**
  7. * Source plugin for terms from a YAML file.
  8. *
  9. * @MigrateSource(
  10. * id = "reinstall_paragraphs"
  11. * )
  12. */
  13. class ReinstallNodeSource extends SimpleSource {
  14. const ENTITY_TYPE = 'node';
  15. /**
  16. * Constructor.
  17. */
  18. public function __construct(
  19. array $configuration,
  20. string $pluginId,
  21. array $pluginDefinition,
  22. MigrationInterface $migration,
  23. EntityTypeBundleInfoInterface $ebi,
  24. EntityFieldManagerInterface $efm
  25. ) {
  26. parent::__construct($configuration, $pluginId, $pluginDefinition, $migration, $ebi, $efm);
  27. $rawRecords = array_map([$this, 'flattenRecord'], $this->initialParse($configuration));
  28. $this->records = $rawRecords;
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function getIds() {
  34. $ids = [
  35. 'nid' => [
  36. 'type' => 'integer',
  37. ],
  38. ];
  39. return $ids;
  40. }
  41. }