You are here

function _migrate_class_list in Migrate 7.2

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

For a given parent class, identify and instantiate objects for any non-abstract classes derived from the parent, returning an array of the objects indexed by class name. The array will be ordered such that any classes with dependencies are listed after the classes they are dependent on.

Parameters

$parent_class: Name of a class from which results will be derived.

Return value

Array of objects, keyed by the class name.

4 calls to _migrate_class_list()
MigrateFieldsEntityHandler::fields in plugins/destinations/fields.inc
Implementation of MigrateDestinationHandler::fields().
migrate_field_handler_invoke_all in ./migrate.module
Invoke any available handlers attached to a given field type.
migrate_handler_invoke_all in ./migrate.module
Invoke any available handlers attached to a given destination type. If any handlers have dependencies defined, they will be invoked after the specified handlers.
migrate_ui_configure_form in migrate_ui/migrate_ui.pages.inc
Form for reviewing migrations.

File

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

Code

function _migrate_class_list($parent_class) {

  // Get info on modules implementing Migrate API
  static $module_info;
  if (!isset($module_info)) {
    $module_info = migrate_get_module_apis();
  }
  static $class_lists = array();
  if (!isset($class_lists[$parent_class])) {
    $class_lists[$parent_class] = array();
    if ($parent_class == 'MigrateDestinationHandler') {
      $handler_key = 'destination handlers';
    }
    else {
      $handler_key = 'field handlers';
    }

    // Add explicitly-registered handler classes
    foreach ($module_info as $info) {
      if (isset($info[$handler_key]) && is_array($info[$handler_key])) {
        foreach ($info[$handler_key] as $handler_class) {
          $class_lists[$parent_class][$handler_class] = new $handler_class();
        }
      }
    }
  }
  return $class_lists[$parent_class];
}