You are here

function migrate_handler_invoke_all in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 migrate.module \migrate_handler_invoke_all()

Invoke any available handlers attached to a given destination type. If any handlers have dependencies defined, they will be invoked after the specified handlers.

Parameters

$destination: Destination type ('Node', 'User', etc.) - generally the same string as the destination class name without the MigrateDestination prefix.

$method: Method name such as 'prepare' (called at the beginning of an import operation) or 'complete' (called at the end of an import operation).

...: Parameters to be passed to the handler.

27 calls to migrate_handler_invoke_all()
MigrateDestinationComment::fields in plugins/destinations/comment.inc
Returns a list of fields available to be mapped for comments attached to a particular bundle (node type)
MigrateDestinationCustomBlock::complete in plugins/destinations/block_custom.inc
Implementation of MigrateDestination::complete().
MigrateDestinationCustomBlock::completeRollback in plugins/destinations/block_custom.inc
Give handlers a shot at cleaning up after a block has been rolled back.
MigrateDestinationCustomBlock::prepare in plugins/destinations/block_custom.inc
Implementation of MigrateDestination::prepare().
MigrateDestinationCustomBlock::prepareRollback in plugins/destinations/block_custom.inc
Give handlers a shot at cleaning up before a block has been rolled back.

... See full list

File

./migrate.module, line 155
API and drush commands to support migration of data from external sources into a Drupal installation.

Code

function migrate_handler_invoke_all($destination, $method) {
  $args = func_get_args();
  array_shift($args);
  array_shift($args);
  $return = array();
  $class_list = _migrate_class_list('MigrateDestinationHandler');
  $disabled = unserialize(variable_get('migrate_disabled_handlers', serialize(array())));
  foreach ($class_list as $class_name => $handler) {
    if (!in_array($class_name, $disabled) && $handler
      ->handlesType($destination) && method_exists($handler, $method)) {
      migrate_instrument_start($class_name . '->' . $method);
      $result = call_user_func_array(array(
        $handler,
        $method,
      ), $args);
      migrate_instrument_stop($class_name . '->' . $method);
      if (isset($result) && is_array($result)) {
        $return = array_merge($return, $result);
      }
      elseif (isset($result)) {
        $return[] = $result;
      }
    }
  }
  return $return;
}