You are here

public function MigrationPluginManager::processDefinition in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate_drupal/src/MigrationPluginManager.php \Drupal\migrate_drupal\MigrationPluginManager::processDefinition()
  2. 10 core/modules/migrate_drupal/src/MigrationPluginManager.php \Drupal\migrate_drupal\MigrationPluginManager::processDefinition()

Performs extra processing on plugin definitions.

By default we add defaults for the type to the definition. If a type has additional processing logic they can do that by replacing or extending the method.

Overrides DefaultPluginManager::processDefinition

File

core/modules/migrate_drupal/src/MigrationPluginManager.php, line 86

Class

MigrationPluginManager
Manages migration plugins.

Namespace

Drupal\migrate_drupal

Code

public function processDefinition(&$definition, $plugin_id) {
  parent::processDefinition($definition, $plugin_id);

  // If the migration has no tags, we don't need to enforce the source_module
  // annotation property.
  if (empty($definition['migration_tags'])) {
    return;
  }

  // Check if the migration has any of the tags that trigger source_module
  // enforcement.
  $applied_tags = array_intersect($this
    ->getEnforcedSourceModuleTags(), $definition['migration_tags']);
  if ($applied_tags) {

    // Throw an exception if the source plugin definition does not define a
    // source_module.
    $source_id = $definition['source']['plugin'];
    $source_definition = $this->sourceManager
      ->getDefinition($source_id);
    if (empty($source_definition['source_module'])) {
      throw new BadPluginDefinitionException($source_id, 'source_module');
    }
  }
}