1. 8.3.x core/modules/migrate/src/Annotation/MigrateSource.php
  2. 8.0.x core/modules/migrate/src/Annotation/MigrateSource.php
  3. 8.1.x core/modules/migrate/src/Annotation/MigrateSource.php
  4. 8.2.x core/modules/migrate/src/Annotation/MigrateSource.php
  5. 8.4.x core/modules/migrate/src/Annotation/MigrateSource.php

Namespace

Drupal\migrate\Annotation

File

core/modules/migrate/src/Annotation/MigrateSource.php
View source
  1. <?php
  2. namespace Drupal\migrate\Annotation;
  3. use Drupal\Component\Annotation\Plugin;
  4. /**
  5. * Defines a migration source plugin annotation object.
  6. *
  7. * Plugin Namespace: Plugin\migrate\source
  8. *
  9. * For a working example, check
  10. * \Drupal\migrate\Plugin\migrate\source\EmptySource
  11. * \Drupal\migrate_drupal\Plugin\migrate\source\UrlAlias
  12. *
  13. * @see \Drupal\migrate\Plugin\MigratePluginManager
  14. * @see \Drupal\migrate\Plugin\MigrateSourceInterface
  15. * @see \Drupal\migrate\Plugin\migrate\source\SourcePluginBase
  16. * @see \Drupal\migrate\Annotation\MigrateProcessPlugin
  17. * @see \Drupal\migrate\Annotation\MigrateDestination
  18. * @see plugin_api
  19. *
  20. * @ingroup migration
  21. *
  22. * @Annotation
  23. */
  24. class MigrateSource extends Plugin implements MultipleProviderAnnotationInterface {
  25. /**
  26. * A unique identifier for the process plugin.
  27. *
  28. * @var string
  29. */
  30. public $id;
  31. /**
  32. * Whether requirements are met.
  33. *
  34. * @var bool
  35. */
  36. public $requirements_met = TRUE;
  37. /**
  38. * Identifies the system providing the data the source plugin will read.
  39. *
  40. * This can be any type, and the source plugin itself determines how the value
  41. * is used. For example, Migrate Drupal's source plugins expect
  42. * source_provider to be the name of a module that must be installed and
  43. * enabled in the source database.
  44. *
  45. * @see \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase::checkRequirements
  46. *
  47. * @var mixed
  48. */
  49. public $source_provider;
  50. /**
  51. * Specifies the minimum version of the source provider.
  52. *
  53. * This can be any type, and the source plugin itself determines how it is
  54. * used. For example, Migrate Drupal's source plugins expect this to be an
  55. * integer representing the minimum installed database schema version of the
  56. * module specified by source_provider.
  57. *
  58. * @var mixed
  59. */
  60. public $minimum_version;
  61. /**
  62. * {@inheritdoc}
  63. */
  64. public function getProvider() {
  65. if (isset($this->definition['provider'])) {
  66. return is_array($this->definition['provider']) ? reset($this->definition['provider']) : $this->definition['provider'];
  67. }
  68. return FALSE;
  69. }
  70. /**
  71. * {@inheritdoc}
  72. */
  73. public function getProviders() {
  74. if (isset($this->definition['provider'])) {
  75. // Ensure that we return an array even if
  76. // \Drupal\Component\Annotation\AnnotationInterface::setProvider() has
  77. // been called.
  78. return (array) $this->definition['provider'];
  79. }
  80. return [];
  81. }
  82. /**
  83. * {@inheritdoc}
  84. */
  85. public function setProviders(array $providers) {
  86. $this->definition['provider'] = $providers;
  87. }
  88. }

Classes

Namesort descending Description
MigrateSource Defines a migration source plugin annotation object.