function ctools_features_export_render in Features 7
Same name and namespace in other branches
- 6 includes/features.ctools.inc \ctools_features_export_render()
- 7.2 includes/features.ctools.inc \ctools_features_export_render()
Implements hook_features_export_render(). Adds the ctools mothership hook, ctools_plugin_api().
File
- includes/
features.ctools.inc, line 78
Code
function ctools_features_export_render($module, $data) {
$component_exports = array();
foreach ($data as $component) {
$code = array();
if ($info = _ctools_features_get_info($component)) {
// For background on why we change the output for hook_views_api()
// see http://drupal.org/node/1459120.
if ($info['module'] == 'views') {
$code[] = ' return array("version" => "3.0");';
}
else {
$code[] = ' list($module, $api) = func_get_args();';
$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;
}