file_entity.api.php
4.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
/**
* @file
* Hooks provided by the File Entity module.
*/
/**
* Define file types.
*
* @return
* 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 hook_file_type_info_alter()
*/
function hook_file_type_info() {
return array(
'image' => array(
'label' => t('Image'),
),
);
}
/**
* Perform alterations on file types.
*
* @param $info
* Array of information on file types exposed by hook_file_type_info()
* implementations.
*/
function hook_file_type_info_alter(&$info) {
// @todo Add example.
}
/**
* @todo Add documentation.
*
* Note: This is not really a hook. The function name is manually specified via
* 'claim callback' in hook_file_type_info(), with this recommended
* callback name pattern.
*/
function hook_file_type_TYPE_claim($file, $type) {
}
/**
* @todo Add documentation.
*
* Note: This is not really a hook. The function name is manually specified via
* 'default view callback' in hook_file_type_info(), with this recommended
* callback name pattern.
*/
function hook_file_type_TYPE_default_view($file, $view_mode, $langcode) {
}
/**
* Define file formatters.
*
* @return
* An array whose keys are file formatter names and whose values are arrays
* describing the formatter.
*
* @todo Document key/value pairs that comprise a formatter.
*
* @see hook_file_formatter_info_alter()
*/
function hook_file_formatter_info() {
// @todo Add example.
}
/**
* Perform alterations on file formatters.
*
* @param $info
* Array of information on file formatters exposed by
* hook_file_formatter_info() implementations.
*/
function hook_file_formatter_info_alter(&$info) {
// @todo Add example.
}
/**
* @todo Add documentation.
*
* Note: This is not really a hook. The function name is manually specified via
* 'view callback' in hook_file_formatter_info(), with this recommended callback
* name pattern.
*/
function hook_file_formatter_FORMATTER_view($file, $display, $langcode) {
}
/**
* @todo Add documentation.
*
* Note: This is not really a hook. The function name is manually specified via
* 'settings callback' in hook_file_formatter_info(), with this recommended
* callback name pattern.
*/
function hook_file_formatter_FORMATTER_settings($form, &$form_state, $settings) {
}
/**
* @todo Add documentation.
*/
function hook_file_displays_alter($displays, $file, $view_mode) {
}
/**
* @todo Add documentation.
*/
function hook_file_view($file, $view_mode, $langcode) {
}
/**
* @todo Add documentation.
*/
function hook_file_view_alter($build, $type) {
}