function uuid_file_features_export_render in UUID Features Integration 6
Same name and namespace in other branches
- 7 includes/uuid_file.features.inc \uuid_file_features_export_render()
Implementation of hook_features_export_render().
File
- includes/
uuid_file.features.inc, line 25 - Features hooks for the uuid_file features component.
Code
function uuid_file_features_export_render($module, $data) {
$translatables = $code = array();
$code[] = ' $files = array();';
$code[] = '';
foreach ($data as $uuid) {
$fid = uuid_get_serial_id('files', 'fid', $uuid);
if (!$fid) {
continue;
}
$file = field_file_load($fid);
$file_parts = explode('.', $file['filepath']);
$extension = array_pop($file_parts);
$export = array(
'uuid' => $uuid,
'hash' => md5_file($file['filepath']),
'extension' => $extension,
);
$code[] = ' $files[] = ' . features_var_export($export, ' ') . ';';
}
if (!empty($translatables)) {
$code[] = features_translatables_export($translatables, ' ');
}
$code[] = ' return $files;';
$code = implode("\n", $code);
return array(
'uuid_features_default_files' => $code,
);
}