function hook_features_export_render in Features 6
Same name and namespace in other branches
- 7.2 features.api.php \hook_features_export_render()
- 7 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.
17 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.
- content_features_export_render in includes/
features.content.inc - Implementation of hook_features_export_render().
- context_features_export_render in includes/
features.context.inc - Implementation of hook_features_export_render().
- 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 - Implementation of hook_features_export_render(). Adds the ctools mothership hook, ctools_plugin_api().
- fieldgroup_features_export_render in includes/
features.fieldgroup.inc - Implementation of hook_features_export_render().
File
- ./
features.api.php, line 154
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", $mycomponents);
return array(
'mycomponent_defaults' => $code,
);
}