You are here

function ctools_configuration_export_render in Configuration Management 7

Implements hook_configuration_export_render(). Adds the ctools mothership hook, ctools_plugin_api().

File

includes/configuration.ctools.inc, line 75

Code

function ctools_configuration_export_render($module, $data) {
  $code = array();
  $code[] = '  list($module, $api) = func_get_args();';
  $component_exports = array();
  foreach ($data as $component) {
    $code = array();
    $code[] = '  list($module, $api) = func_get_args();';
    if ($info = _ctools_configuration_get_info($component)) {
      $code[] = '  if ($module == "' . $info['module'] . '" && $api == "' . $info['api'] . '") {';
      $code[] = '    return array("version" => "' . $info['current_version'] . '");';
      $code[] = '  }';
    }
    ctools_include('plugins');
    $plugin_api_hook_name = ctools_plugin_api_get_hook($info['module'], $info['api']);
    if (key_exists($plugin_api_hook_name, $component_exports)) {
      $component_exports[$plugin_api_hook_name] .= "\n" . implode("\n", $code);
    }
    else {
      $component_exports[$plugin_api_hook_name] = implode("\n", $code);
    }
  }
  return $component_exports;
}