Commit 4e5b4b09 authored by catch's avatar catch

Issue #2931368 by opdavies: Add missing param documentation for...

Issue #2931368 by opdavies: Add missing param documentation for hook_migrate_prepare_row, document hook_migrate_MIGRATION_ID_prepare_row
parent 962122ef
......@@ -98,6 +98,13 @@
*
* hook_migrate_MIGRATION_ID_prepare_row() is also available.
*
* @param \Drupal\migrate\Row $row
* The row being imported.
* @param \Drupal\migrate\Plugin\MigrateSourceInterface $source
* The source migration.
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The current migration.
*
* @ingroup migration
*/
function hook_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
......@@ -109,6 +116,28 @@ function hook_migrate_prepare_row(Row $row, MigrateSourceInterface $source, Migr
}
}
/**
* Allows adding data to a row for a migration with the specified ID.
*
* This provides the same functionality as hook_migrate_prepare_row() but
* removes the need to check the value of $migration->id().
*
* @param \Drupal\migrate\Row $row
* The row being imported.
* @param \Drupal\migrate\Plugin\MigrateSourceInterface $source
* The source migration.
* @param \Drupal\migrate\Plugin\MigrationInterface $migration
* The current migration.
*
* @ingroup migration
*/
function hook_migrate_MIGRATION_ID_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) {
$value = $source->getDatabase()->query('SELECT value FROM {variable} WHERE name = :name', [':name' => 'mymodule_filter_foo_' . $row->getSourceProperty('format')])->fetchField();
if ($value) {
$row->setSourceProperty('settings:mymodule:foo', unserialize($value));
}
}
/**
* Allows altering the list of discovered migration plugins.
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment