You are here

function migrate_destination_invoke_all in Migrate 6

Call a destination hook (e.g., hook_migrate_prepare_node). Use this version for hooks with the precise signature below, so that the object can be passed by reference.

Parameters

$hook: Hook to invoke (e.g., 'types', 'fields_node', etc.)

$object: Destination object being built - passed by reference, so hooks can modify it

$tblinfo: Metadata about the content set

$row: The raw source row.

Return value

Merged array of results.

5 calls to migrate_destination_invoke_all()
comment_migrate_import_comment in modules/comment.migrate.inc
Implementation of hook_migrate_import_comment().
node_migrate_import_node in modules/node.migrate.inc
Implementation of hook_migrate_import_node().
taxonomy_migrate_import_term in modules/taxonomy.migrate.inc
Implementation of hook_migrate_import_term().
user_migrate_import_role in modules/user.migrate.inc
Implementation of hook_migrate_import_role().
user_migrate_import_user in modules/user.migrate.inc
Implementation of hook_migrate_import_user().

File

./migrate.module, line 83
This module provides tools at "administer >> content >> migrate" for analyzing data from various sources and importing them into Drupal tables.

Code

function migrate_destination_invoke_all($hook, &$object, $tblinfo, $row) {

  // Let modules do any one-time initialization (e.g., including migration support files)
  global $_migrate_inited;
  if (!isset($_migrate_inited)) {
    module_invoke_all('migrate_init');
    $_migrate_inited = TRUE;
  }

  // We could have used module_invoke_all, but unfortunately
  // module_invoke_all passes all arguments by value.
  $errors = array();
  $hook = 'migrate_' . $hook;
  foreach (module_implements($hook) as $module_name) {
    $function = $module_name . '_' . $hook;
    if (function_exists($function)) {
      timer_start($function);
      $errors = array_merge($errors, (array) $function($object, $tblinfo, $row));
      timer_stop($function);
    }
  }
  return $errors;
}