Chris@0: id() == 'd6_filter_formats') { Chris@0: $value = $source->getDatabase()->query('SELECT value FROM {variable} WHERE name = :name', [':name' => 'mymodule_filter_foo_' . $row->getSourceProperty('format')])->fetchField(); Chris@0: if ($value) { Chris@0: $row->setSourceProperty('settings:mymodule:foo', unserialize($value)); Chris@0: } Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@14: * Allows adding data to a row for a migration with the specified ID. Chris@14: * Chris@14: * This provides the same functionality as hook_migrate_prepare_row() but Chris@14: * removes the need to check the value of $migration->id(). Chris@14: * Chris@14: * @param \Drupal\migrate\Row $row Chris@14: * The row being imported. Chris@14: * @param \Drupal\migrate\Plugin\MigrateSourceInterface $source Chris@14: * The source migration. Chris@14: * @param \Drupal\migrate\Plugin\MigrationInterface $migration Chris@14: * The current migration. Chris@14: * Chris@14: * @ingroup migration Chris@14: */ Chris@14: function hook_migrate_MIGRATION_ID_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) { Chris@14: $value = $source->getDatabase()->query('SELECT value FROM {variable} WHERE name = :name', [':name' => 'mymodule_filter_foo_' . $row->getSourceProperty('format')])->fetchField(); Chris@14: if ($value) { Chris@14: $row->setSourceProperty('settings:mymodule:foo', unserialize($value)); Chris@14: } Chris@14: } Chris@14: Chris@14: /** Chris@0: * Allows altering the list of discovered migration plugins. Chris@0: * Chris@0: * Modules are able to alter specific migrations structures or even remove or Chris@0: * append additional migrations to the discovery. For example, this Chris@0: * implementation filters out Drupal 6 migrations from the discovered migration Chris@0: * list. This is done by checking the migration tags. Chris@0: * Chris@0: * @param array[] $migrations Chris@0: * An associative array of migrations keyed by migration ID. Each value is the Chris@0: * migration array, obtained by decoding the migration YAML file and enriched Chris@0: * with some meta information added during discovery phase, like migration Chris@0: * 'class', 'provider' or '_discovered_file_path'. Chris@0: * Chris@0: * @ingroup migration Chris@0: */ Chris@0: function hook_migration_plugins_alter(array &$migrations) { Chris@0: $migrations = array_filter($migrations, function (array $migration) { Chris@0: $tags = isset($migration['migration_tags']) ? (array) $migration['migration_tags'] : []; Chris@0: return !in_array('Drupal 6', $tags); Chris@0: }); Chris@0: } Chris@0: Chris@0: /** Chris@0: * @} End of "addtogroup hooks". Chris@0: */