diff --git a/core/modules/field/migration_templates/d7_field.yml b/core/modules/field/migration_templates/d7_field.yml index 1fa0069..85bfdf1 100644 --- a/core/modules/field/migration_templates/d7_field.yml +++ b/core/modules/field/migration_templates/d7_field.yml @@ -9,6 +9,7 @@ source: constants: status: true langcode: und + source_module: field process: entity_type: entity_type status: 'constants/status' diff --git a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php index 090efd0..3750ca1 100644 --- a/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php +++ b/core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php @@ -2,6 +2,7 @@ namespace Drupal\migrate\Plugin; +use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -61,4 +62,17 @@ public function createInstance($plugin_id, array $configuration = [], MigrationI return parent::createInstance($plugin_id, $configuration, $migration); } + /** + * {@inheritdoc} + */ + public function processDefinition(&$definition, $plugin_id) { + parent::processDefinition($definition, $plugin_id); + + foreach (['destination_module'] as $required_property) { + if (empty($definition[$required_property])) { + throw new InvalidPluginDefinitionException($plugin_id, sprintf('The %s plugin should define the %s property.', $plugin_id, $required_property)); + } + } + } + } diff --git a/core/modules/migrate/src/Plugin/MigratePluginManager.php b/core/modules/migrate/src/Plugin/MigratePluginManager.php index b3645db..7903e42 100644 --- a/core/modules/migrate/src/Plugin/MigratePluginManager.php +++ b/core/modules/migrate/src/Plugin/MigratePluginManager.php @@ -2,6 +2,7 @@ namespace Drupal\migrate\Plugin; +use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException; use Drupal\Component\Plugin\Factory\DefaultFactory; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; @@ -62,4 +63,17 @@ public function createInstance($plugin_id, array $configuration = [], MigrationI return $plugin; } + /** + * {@inheritdoc} + */ + public function processDefinition(&$definition, $plugin_id) { + parent::processDefinition($definition, $plugin_id); + + foreach (['id'] as $required_property) { + if (empty($definition['id'])) { + throw new InvalidPluginDefinitionException($plugin_id, sprintf('The %s plugin should define the %s property.', $plugin_id, $required_property)); + } + } + } + } diff --git a/core/modules/migrate/src/Plugin/MigrateSourcePluginManager.php b/core/modules/migrate/src/Plugin/MigrateSourcePluginManager.php index 965da5d..11883e5 100644 --- a/core/modules/migrate/src/Plugin/MigrateSourcePluginManager.php +++ b/core/modules/migrate/src/Plugin/MigrateSourcePluginManager.php @@ -2,6 +2,7 @@ namespace Drupal\migrate\Plugin; +use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\migrate\Plugin\Discovery\AnnotatedClassDiscoveryAutomatedProviders; @@ -70,4 +71,17 @@ protected function findDefinitions() { }); } + /** + * {@inheritdoc} + */ + public function processDefinition(&$definition, $plugin_id) { + parent::processDefinition($definition, $plugin_id); + + foreach (['source_module'] as $required_property) { + if (empty($definition[$required_property])) { + throw new InvalidPluginDefinitionException($plugin_id, sprintf('The %s plugin should define the %s property.', $plugin_id, $required_property)); + } + } + } + } diff --git a/core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php b/core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php index 8cee6dd..2be0b5e 100644 --- a/core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php +++ b/core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php @@ -38,7 +38,8 @@ * @see \Drupal\migrate\Plugin\MigrateSourceInterface * * @MigrateSource( - * id = "embedded_data" + * id = "embedded_data", + * source_module = "migrate" * ) */ class EmbeddedDataSource extends SourcePluginBase { diff --git a/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php b/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php index 2391b0a..4ae99e8 100644 --- a/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php +++ b/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php @@ -8,7 +8,8 @@ * This is generally useful when needing to create a field using a migration.. * * @MigrateSource( - * id = "empty" + * id = "empty", + * source_module = "migrate" * ) */ class EmptySource extends SourcePluginBase { diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php index 6792e5e..78ef1a7 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/EmptySource.php @@ -15,7 +15,8 @@ * Source returning an empty row with Drupal specific config dependencies. * * @MigrateSource( - * id = "md_empty" + * id = "md_empty", + * source_module = "migrate_drupal" * ) */ class EmptySource extends BaseEmptySource implements ContainerFactoryPluginInterface, DependentPluginInterface { diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/Variable.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/Variable.php index 410acec..471016a 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/Variable.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/Variable.php @@ -13,7 +13,8 @@ * example for any normal source class returning multiple rows. * * @MigrateSource( - * id = "variable" + * id = "variable", + * source_module = "migrate_drupal" * ) */ class Variable extends DrupalSqlBase { diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/VariableMultiRow.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/VariableMultiRow.php index 61da5eb..17848c5 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/VariableMultiRow.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/VariableMultiRow.php @@ -11,7 +11,8 @@ * variable. * * @MigrateSource( - * id = "variable_multirow" + * id = "variable_multirow", + * source_module = "migrate_drupal" * ) */ class VariableMultiRow extends DrupalSqlBase { diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php index 566a840..0b423c7 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php @@ -11,7 +11,8 @@ * Drupal i18n_variable source from database. * * @MigrateSource( - * id = "variable_translation" + * id = "variable_translation", + * source_module = "migrate_drupal" * ) */ class VariableTranslation extends DrupalSqlBase { diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/i18nVariable.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/i18nVariable.php index dd8d0f0..5f5ee32 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/i18nVariable.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/i18nVariable.php @@ -8,7 +8,8 @@ * Drupal i18n_variable source from database. * * @MigrateSource( - * id = "i18n_variable" + * id = "i18n_variable", + * source_module = "migrate_drupal" * ) * * @deprecated in Drupal 8.4.x and will be removed in Drupal 9.0.x. Use diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php index 8d83387..f66d9b4 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/d8/Config.php @@ -9,7 +9,8 @@ * Drupal config source from database. * * @MigrateSource( - * id = "d8_config" + * id = "d8_config", + * source_module = "migrate_drupal" * ) */ class Config extends DrupalSqlBase {