You are here

function migrate_get_module_apis in Migrate 6

Same name and namespace in other branches
  1. 6.2 migrate.module \migrate_get_module_apis()
  2. 7.2 migrate.module \migrate_get_module_apis()

Get a list of modules that support the current migrate API.

2 calls to migrate_get_module_apis()
migrate_module_include in ./migrate.module
Load views files on behalf of modules.
_migrate_settings_form in ./migrate_pages.inc
Form definition for settings page.

File

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

Code

function migrate_get_module_apis($reset = FALSE) {
  static $cache = NULL;
  if ($reset) {
    $cache = NULL;
  }
  if (!isset($cache)) {
    $cache = array();
    foreach (module_implements('migrate_api') as $module) {
      $function = $module . '_migrate_api';
      $info = $function();
      if (isset($info['api']) && $info['api'] == 1.0) {
        if (isset($info['path'])) {
          $info['path'] = drupal_get_path('module', $module) . '/' . $info['path'];
        }
        else {
          $info['path'] = drupal_get_path('module', $module);
        }
        if (!isset($info['integration modules'])) {
          $info['integration modules'] = array(
            $module => array(),
          );
        }
        $settings = variable_get('migrate_integration_settings', NULL);
        foreach ($info['integration modules'] as $intmod_name => $intmod_details) {

          // If the module was just entered as a string without details, we have to fix.
          if (!is_array($intmod_details)) {
            unset($info['integration modules'][$intmod_name]);
            $intmod_name = $intmod_details;
            $intmod_details = array();
          }
          $default_details = array(
            'description' => t('Support for the @intmod module.', array(
              '@intmod' => $intmod_name,
            )),
            'status' => TRUE,
          );

          // Allow override of defaults.
          $info['integration modules'][$intmod_name] = $intmod_details + $default_details;

          // Overwrite default status if set.
          if (isset($settings[$module][$intmod_name])) {
            $info['integration modules'][$intmod_name]['status'] = $settings[$module][$intmod_name];
          }
        }
        $cache[$module] = $info;
      }
      else {
        drupal_set_message(t('%function supports Migrate API version %modversion,
           Migrate module API version is %version - migration support not loaded.', array(
          '%function' => $function,
          '%modversion' => $info['api'],
          '%version' => MIGRATE_API_VERSION,
        )));
      }
    }
  }
  return $cache;
}