function farm_fields_file_types in farmOS 7
Returns a list of acceptable file types for image/file fields.
Parameters
string $type: Can be 'image', 'file', or empty (to return all).
string $separator: Separator string to put between type in the output.
Return value
string Returns a string of types.
2 calls to farm_fields_file_types()
- farm_fields_field_default_field_instances_alter in modules/
farm/ farm_fields/ farm_fields.module - Implements hook_field_default_field_instances_alter().
- farm_livestock_move_form in modules/
farm/ farm_livestock/ farm_livestock.farm_quick.move.inc - Form for adding animal movement logs.
File
- modules/
farm/ farm_fields/ farm_fields.module, line 62
Code
function farm_fields_file_types($type = '', $separator = ' ') {
$file_types = array(
'image' => array(
'png',
'gif',
'jpg',
'jpeg',
),
'file' => array(
'csv',
'doc',
'docx',
'logz',
'odt',
'odp',
'ods',
'pdf',
'ppt',
'pptx',
'txt',
'xls',
'xlsx',
'kml',
'kmz',
'mp3',
'wav',
'ogg',
),
);
if ($type == 'image') {
$types = $file_types['image'];
}
elseif ($type == 'file') {
$types = $file_types['file'];
}
else {
$types = array_merge($file_types['image'], $file_types['file']);
}
return implode($separator, $types);
}