function hook_features_export_render in Features 7
Same name and namespace in other branches
- 6 features.api.php \hook_features_export_render()
- 7.2 features.api.php \hook_features_export_render()
Component hook. The hook should be implemented using the name ot the component, not the module, eg. [component]_features_export() rather than [module]_features_export().
Render one or more component objects to code.
Parameters
string $module_name: The name of the feature module to be exported.
array $data: An array of machine name identifiers for the objects to be rendered.
array $export: The full export array of the current feature being exported. This is only passed when hook_features_export_render() is invoked for an actual feature update or recreate, not during state checks or other operations.
Return value
array An associative array of rendered PHP code where the key is the name of the hook that should wrap the PHP code. The hook should not include the name of the module, e.g. the key for `hook_example` should simply be `example` The values in the array can also be in the form of an associative array with the required key of 'code' and optional key of 'args', if 'args' need to be added to the hook.
13 functions implement hook_features_export_render()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- ctools_component_features_export_render in includes/
features.ctools.inc - Master implementation of hook_features_export_render() for all ctools components.
- ctools_features_export_render in includes/
features.ctools.inc - Implements hook_features_export_render(). Adds the ctools mothership hook, ctools_plugin_api().
- field_features_export_render in includes/
features.field.inc - Implements hook_features_export_render().
- filter_features_export_render in includes/
features.filter.inc - Implements hook_features_export_render().
- image_features_export_render in includes/
features.image.inc - Implements hook_features_export_render().
File
- ./
features.api.php, line 162
Code
function hook_features_export_render($module_name, $data, $export = NULL) {
$code = array();
$code[] = '$mycomponents = array();';
foreach ($data as $name) {
$code[] = " \$mycomponents['{$name}'] = " . features_var_export(mycomponent_load($name)) . ";";
}
$code[] = "return \$mycomponents;";
$code = implode("\n", $code);
return array(
'mycomponent_defaults' => $code,
);
}