function namefield_features_export_render in Name Field 7
Implements hook_features_export_render().
File
- includes/
name.features.inc, line 33
Code
function namefield_features_export_render($module_name, $data, $export = NULL) {
$code = array();
$code[] = ' $formats = array();';
$code[] = '';
foreach ($data as $name) {
if ($name == 'default') {
$format = name_settings();
$format['machine_name'] = 'default';
$format['name'] = t('Default');
$format = (object) $format;
}
else {
$format = db_select('name_custom_format', 'ncf')
->fields('ncf')
->condition('machine_name', $name)
->execute()
->fetch();
unset($format->ncfid);
}
if ($format) {
$format_export = features_var_export($format, ' ');
$format_identifier = features_var_export($format->machine_name);
$code[] = " // Exported format: {$format->name}";
$code[] = " \$formats[{$format_identifier}] = {$format_export};";
$code[] = "";
}
}
$code[] = ' return $formats;';
$code = implode("\n", $code);
return array(
'name_default_formats' => $code,
);
}