function hook_file_type_info in D7 Media 7
Define file types.
Return value
An array whose keys are file type names and whose values are arrays describing the file type, with the following key/value pairs:
- label: The human-readable name of the file type.
- claim callback: The name of the function that returns if a given file is of this type. See hook_file_type_TYPE_claim() for details.
- default view callback: (optional) The name of the function that returns a drupal_render() array for displaying the file. Used when there are no administrator configured file formatters, or none of the configured ones return a display. See hook_file_type_TYPE_default_view() for details.
- description: (optional) A short description of the file type.
- weight: (optional) A number defining the order in which the 'claim callback' function for this type is called relative to the claim callbacks of other defined types, when the type of a file needs to be determined. The type with the lowest weighted claim callback to return TRUE is assigned to the file. Also, on administrative pages listing file types, the types are ordered by weight.
- admin: (optional) An array of information, to be added to the ['bundles'][TYPE]['admin'] entry for the 'file' entity type, thereby controlling the path at which Field UI pages are attached for this file type, and which users may access them. Defaults to attaching the Field UI pages to the admin/config/media/file-types/manage/TYPE path and requiring 'administer site configuration' permission. See hook_entity_info() for details about this array. This value can also be set to NULL to suppress Field UI pages from attaching at all for this file type.
See also
2 functions implement hook_file_type_info()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- file_entity_test_file_type_info in file_entity/
tests/ file_entity_test.module - Implements hook_file_type_info().
- media_file_type_info in includes/
media.types.inc - Implements hook_file_type_info().
1 invocation of hook_file_type_info()
- file_info_file_types in file_entity/
file_entity.file_api.inc - Returns information about file types from hook_file_type_info().
File
- file_entity/
file_entity.api.php, line 39 - Hooks provided by the File Entity module.
Code
function hook_file_type_info() {
return array(
'image' => array(
'label' => t('Image'),
),
);
}