Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MigrateSource.php

class MigrateSource

Defines a migration source plugin annotation object.

Plugin Namespace: Plugin\migrate\source

For a working example, check \Drupal\migrate\Plugin\migrate\source\EmptySource \Drupal\migrate_drupal\Plugin\migrate\source\UrlAlias

Hierarchy

  • class \Drupal\Component\Annotation\Plugin implements \Drupal\Component\Annotation\AnnotationInterface
    • class \Drupal\migrate\Annotation\MigrateSource extends \Drupal\Component\Annotation\Plugin implements \Drupal\migrate\Annotation\MultipleProviderAnnotationInterface

Expanded class hierarchy of MigrateSource

See also

\Drupal\migrate\Plugin\MigratePluginManager

\Drupal\migrate\Plugin\MigrateSourceInterface

\Drupal\migrate\Plugin\migrate\source\SourcePluginBase

\Drupal\migrate\Annotation\MigrateProcessPlugin

\Drupal\migrate\Annotation\MigrateDestination

Plugin API

Related topics

Migrate API
Overview of the Migrate API, which migrates data into Drupal.
Annotations
Annotations for class discovery and metadata description.
104 classes are annotated with MigrateSource
Action in core/modules/system/src/Plugin/migrate/source/Action.php
Drupal action source from database.
Block in core/modules/block/src/Plugin/migrate/source/Block.php
Drupal 6/7 block source from database.
BlockCustom in core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustom.php
Drupal 7 content block source from database.
BlockCustomTranslation in core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustomTranslation.php
Drupal 7 i18n content block translations source from database.
BlockedIps in core/modules/ban/src/Plugin/migrate/source/d7/BlockedIps.php
Drupal 7 blocked IPs source from database.

... See full list

File

core/modules/migrate/src/Annotation/MigrateSource.php, line 27

Namespace

Drupal\migrate\Annotation
View source
class MigrateSource extends Plugin implements MultipleProviderAnnotationInterface {
    
    /**
     * A unique identifier for the process plugin.
     *
     * @var string
     */
    public $id;
    
    /**
     * Whether requirements are met.
     *
     * @var bool
     */
    public $requirements_met = TRUE;
    
    /**
     * Identifies the system providing the data the source plugin will read.
     *
     * The source plugin itself determines how the value is used. For example,
     * Migrate Drupal's source plugins expect source_module to be the name of a
     * module that must be installed and enabled in the source database.
     *
     * @var string
     *
     * @see \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase::checkRequirements
     */
    public $source_module;
    
    /**
     * Specifies the minimum version of the source provider.
     *
     * This can be any type, and the source plugin itself determines how it is
     * used. For example, Migrate Drupal's source plugins expect this to be an
     * integer representing the minimum installed database schema version of the
     * module specified by source_module.
     *
     * @var mixed
     */
    public $minimum_version;
    
    /**
     * {@inheritdoc}
     */
    public function getProvider() {
        if (isset($this->definition['provider'])) {
            return is_array($this->definition['provider']) ? reset($this->definition['provider']) : $this->definition['provider'];
        }
        return FALSE;
    }
    
    /**
     * {@inheritdoc}
     */
    public function getProviders() {
        if (isset($this->definition['provider'])) {
            // Ensure that we return an array even if
            // \Drupal\Component\Annotation\AnnotationInterface::setProvider() has
            // been called.
            return (array) $this->definition['provider'];
        }
        return [];
    }
    
    /**
     * {@inheritdoc}
     */
    public function setProviders(array $providers) {
        $this->definition['provider'] = $providers;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
MigrateSource::$id public property A unique identifier for the process plugin.
MigrateSource::$minimum_version public property Specifies the minimum version of the source provider.
MigrateSource::$requirements_met public property Whether requirements are met.
MigrateSource::$source_module public property Identifies the system providing the data the source plugin will read.
MigrateSource::getProvider public function Gets the name of the provider of the annotated class. Overrides Plugin::getProvider
MigrateSource::getProviders public function Gets the provider names of the annotated class. Overrides MultipleProviderAnnotationInterface::getProviders
MigrateSource::setProviders public function Sets the provider names of the annotated class. Overrides MultipleProviderAnnotationInterface::setProviders
Plugin::$definition protected property The plugin definition read from the class annotation. 1
Plugin::get public function Gets the value of an annotation. Overrides AnnotationInterface::get 5
Plugin::getClass public function Gets the class of the annotated class. Overrides AnnotationInterface::getClass 1
Plugin::getId public function Gets the unique ID for this annotated class. Overrides AnnotationInterface::getId
Plugin::parse protected function Parses an annotation into its definition.
Plugin::setClass public function Sets the class of the annotated class. Overrides AnnotationInterface::setClass 1
Plugin::setProvider public function Sets the name of the provider of the annotated class. Overrides AnnotationInterface::setProvider
Plugin::__construct public function Constructs a Plugin object. 3
RSS feed
Powered by Drupal