function hook_migration_plugins_alter
Same name in other branches
- 9 core/modules/migrate/migrate.api.php \hook_migration_plugins_alter()
- 10 core/modules/migrate/migrate.api.php \hook_migration_plugins_alter()
- 11.x core/modules/migrate/migrate.api.php \hook_migration_plugins_alter()
Allows altering the list of discovered migration plugins.
Modules are able to alter specific migrations structures or even remove or append additional migrations to the discovery. For example, this implementation filters out Drupal 6 migrations from the discovered migration list. This is done by checking the migration tags.
Parameters
array[] $migrations: An associative array of migrations keyed by migration ID. Each value is the migration array, obtained by decoding the migration YAML file and enriched with some meta information added during discovery phase, like migration 'class', 'provider' or '_discovered_file_path'.
Related topics
2 functions implement hook_migration_plugins_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- book_migration_plugins_alter in core/
modules/ book/ book.module - Implements hook_migration_plugins_alter().
- migrate_drupal_migration_plugins_alter in core/
modules/ migrate_drupal/ migrate_drupal.module - Implements hook_migration_plugins_alter().
1 invocation of hook_migration_plugins_alter()
- MigrationPluginManager::__construct in core/
modules/ migrate/ src/ Plugin/ MigrationPluginManager.php - Construct a migration plugin manager.
File
-
core/
modules/ migrate/ migrate.api.php, line 161
Code
function hook_migration_plugins_alter(array &$migrations) {
$migrations = array_filter($migrations, function (array $migration) {
$tags = isset($migration['migration_tags']) ? (array) $migration['migration_tags'] : [];
return !in_array('Drupal 6', $tags);
});
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.