3 namespace Drupal\migrate\Annotation;
5 use Drupal\Component\Annotation\Plugin;
8 * Defines a migration source plugin annotation object.
10 * Plugin Namespace: Plugin\migrate\source
12 * For a working example, check
13 * \Drupal\migrate\Plugin\migrate\source\EmptySource
14 * \Drupal\migrate_drupal\Plugin\migrate\source\UrlAlias
16 * @see \Drupal\migrate\Plugin\MigratePluginManager
17 * @see \Drupal\migrate\Plugin\MigrateSourceInterface
18 * @see \Drupal\migrate\Plugin\migrate\source\SourcePluginBase
19 * @see \Drupal\migrate\Annotation\MigrateProcessPlugin
20 * @see \Drupal\migrate\Annotation\MigrateDestination
27 class MigrateSource extends Plugin implements MultipleProviderAnnotationInterface {
30 * A unique identifier for the process plugin.
37 * Whether requirements are met.
41 public $requirements_met = TRUE;
44 * Identifies the system providing the data the source plugin will read.
46 * The source plugin itself determines how the value is used. For example,
47 * Migrate Drupal's source plugins expect source_module to be the name of a
48 * module that must be installed and enabled in the source database.
50 * @see \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase::checkRequirements
54 public $source_module;
57 * Specifies the minimum version of the source provider.
59 * This can be any type, and the source plugin itself determines how it is
60 * used. For example, Migrate Drupal's source plugins expect this to be an
61 * integer representing the minimum installed database schema version of the
62 * module specified by source_module.
66 public $minimum_version;
71 public function getProvider() {
72 if (isset($this->definition['provider'])) {
73 return is_array($this->definition['provider']) ? reset($this->definition['provider']) : $this->definition['provider'];
81 public function getProviders() {
82 if (isset($this->definition['provider'])) {
83 // Ensure that we return an array even if
84 // \Drupal\Component\Annotation\AnnotationInterface::setProvider() has
86 return (array) $this->definition['provider'];
94 public function setProviders(array $providers) {
95 $this->definition['provider'] = $providers;