function file_info_file_types in File Entity (fieldable files) 7
Returns information about file types from hook_file_type_info().
Parameters
$file_type: (optional) A file type name. If ommitted, all file types will be returned.
Return value
Either a file type description, as provided by hook_file_type_info(), or an array of all existing file types, keyed by file type name.
4 calls to file_info_file_types()
- file_entity_entity_info_alter in ./
file_entity.module - Implements hook_entity_info_alter().
- file_entity_list_types_page in ./
file_entity.admin.inc - Displays the file type admin overview page.
- file_entity_tokens in ./
file_entity.tokens.inc - Implements hook_tokens().
- file_view_file in ./
file_entity.file_api.inc - Generate an array for rendering just the file portion of a file entity.
1 string reference to 'file_info_file_types'
- file_info_cache_clear in ./
file_entity.file_api.inc - Clears the file info cache.
File
- ./
file_entity.file_api.inc, line 18 - API extensions of Drupal core's file.inc.
Code
function file_info_file_types($file_type = NULL) {
$info =& drupal_static(__FUNCTION__);
if (!isset($info)) {
$info = module_invoke_all('file_type_info');
// Add support for the standard file types until this can be fully
// abstracted out of Media module.
$info += array(
'application' => array(
'label' => t('Application (multipurpose)'),
),
'audio' => array(
'label' => t('Audio'),
),
'image' => array(
'label' => t('Image'),
),
'text' => array(
'label' => t('Text'),
),
'video' => array(
'label' => t('Video'),
),
);
drupal_alter('file_type_info', $info);
uasort($info, '_file_entity_sort_weight_label');
}
if ($file_type) {
if (isset($info[$file_type])) {
return $info[$file_type];
}
}
else {
return $info;
}
}