function hook_file_type in File Entity (fieldable files) 7.3
Same name and namespace in other branches
- 8.2 file_entity.api.php \hook_file_type()
- 7.2 file_entity.api.php \hook_file_type()
Decides which file type (bundle) should be assigned to a file entity.
Parameters
object $file: File object.
Return value
array Array of file type machine names that can be assigned to a given file type. If there are more proposed file types the one, that was returned the first, wil be chosen. This can be, however, changed in alter hook.
See also
1 function implements hook_file_type()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- file_entity_file_type in ./
file_entity.file.inc - Implements hook_file_type().
2 invocations of hook_file_type()
- file_entity_get_filetype_candidates in ./
file_entity.pages.inc - Get the candidate filetypes for a given file.
- file_get_type in ./
file_entity.file_api.inc - Determines file type for a given file.
File
- ./
file_entity.api.php, line 365 - Hooks provided by the File Entity module.
Code
function hook_file_type($file) {
// Assign all files uploaded by anonymous users to a special file type.
if (user_is_anonymous()) {
return array(
'untrusted_files',
);
}
}