You are here

function migrate_handler_invoke_all in Migrate 6.2

Same name and namespace in other branches
  1. 7.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.

8 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)
MigrateDestinationEntity::complete in plugins/destinations/entity.inc
Give handlers a shot at modifying the object (or taking additional action) after saving it.
MigrateDestinationEntity::completeRollback in plugins/destinations/entity.inc
Give handlers a shot at cleaning up after an entity has been rolled back.
MigrateDestinationEntity::prepare in plugins/destinations/entity.inc
Give handlers a shot at modifying the object before saving it.
MigrateDestinationEntity::prepareRollback in plugins/destinations/entity.inc
Give handlers a shot at cleaning up before an entity has been rolled back.

... See full list

File

./migrate.module, line 195

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;
}