You are here

function ctools_features_export_render in Features 6

Same name and namespace in other branches
  1. 7.2 includes/features.ctools.inc \ctools_features_export_render()
  2. 7 includes/features.ctools.inc \ctools_features_export_render()

Implementation of hook_features_export_render(). Adds the ctools mothership hook, ctools_plugin_api().

File

includes/features.ctools.inc, line 68

Code

function ctools_features_export_render($module, $data) {
  $code = array();
  $code[] = '  list($module, $api) = func_get_args();';
  $first = TRUE;
  foreach ($data as $component) {
    if ($info = _ctools_features_get_info($component)) {
      $if = $first ? 'if' : 'elseif';
      $code[] = '  ' . $if . ' ($module == "' . $info['module'] . '" && $api == "' . $info['api'] . '") {';
      $code[] = '    return array("version" => ' . $info['current_version'] . ');';
      $code[] = '  }';
      $first = FALSE;
    }
  }
  return array(
    'ctools_plugin_api' => implode("\n", $code),
  );
}