function fieldgroup_features_export_render in Features 6
Implementation of hook_features_export_render().
File
- includes/
features.fieldgroup.inc, line 58
Code
function fieldgroup_features_export_render($module, $data) {
$translatables = $code = array();
$code[] = ' $groups = array();';
$code[] = '';
foreach ($data as $instance) {
$instance = explode('-', $instance);
$type_name = $instance[0];
$group_name = $instance[1];
$groups = fieldgroup_groups($type_name, FALSE, TRUE);
if (isset($groups[$group_name]) && ($group = $groups[$group_name])) {
// Clean up the fields to only list the names.
$group['fields'] = array_keys((array) $group['fields']);
$group_identifier = features_var_export(fieldgroup_features_identifier($group));
$group_export = features_var_export($group, ' ');
$code[] = " // Exported group: {$group_name}";
$code[] = " \$groups[{$group_identifier}] = {$group_export};";
$code[] = "";
// Add any labels to translatables array.
if (!empty($group['label'])) {
$translatables[] = $group['label'];
}
// Add any descriptions to translatables array.
if (!empty($group['settings']['form']['description'])) {
$translatables[] = $group['settings']['form']['description'];
}
}
}
if (!empty($translatables)) {
$code[] = features_translatables_export($translatables, ' ');
}
$code[] = ' return $groups;';
$code = implode("\n", $code);
return array(
'fieldgroup_default_groups' => $code,
);
}