1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Provide views data and handlers for system.module.
|
6 |
|
|
*
|
7 |
|
|
* @ingroup views_module_handlers
|
8 |
|
|
*/
|
9 |
|
|
|
10 |
|
|
/**
|
11 |
|
|
* Implements hook_views_data().
|
12 |
|
|
*/
|
13 |
|
|
function system_views_data() {
|
14 |
|
|
$data = array();
|
15 |
|
|
|
16 |
|
|
// ----------------------------------------------------------------------
|
17 |
5d12d676
|
Assos Assos
|
// 'file_managed' table.
|
18 |
85ad3d82
|
Assos Assos
|
$data['files']['moved to'] = 'file_managed';
|
19 |
|
|
$data['file_managed']['table']['group'] = t('File');
|
20 |
|
|
|
21 |
5d12d676
|
Assos Assos
|
// Advertise this table as a possible base table.
|
22 |
85ad3d82
|
Assos Assos
|
$data['file_managed']['table']['base'] = array(
|
23 |
|
|
'field' => 'fid',
|
24 |
|
|
'title' => t('File'),
|
25 |
|
|
'help' => t("Files maintained by Drupal and various modules."),
|
26 |
|
|
'defaults' => array(
|
27 |
5d12d676
|
Assos Assos
|
'field' => 'filename',
|
28 |
85ad3d82
|
Assos Assos
|
),
|
29 |
|
|
);
|
30 |
|
|
$data['file_managed']['table']['entity type'] = 'file';
|
31 |
|
|
|
32 |
5d12d676
|
Assos Assos
|
// File ID / 'fid'.
|
33 |
85ad3d82
|
Assos Assos
|
$data['file_managed']['fid'] = array(
|
34 |
|
|
'title' => t('File ID'),
|
35 |
|
|
'help' => t('The ID of the file.'),
|
36 |
|
|
'field' => array(
|
37 |
|
|
'handler' => 'views_handler_field_file',
|
38 |
|
|
'click sortable' => TRUE,
|
39 |
|
|
),
|
40 |
|
|
'argument' => array(
|
41 |
|
|
'handler' => 'views_handler_argument_file_fid',
|
42 |
5d12d676
|
Assos Assos
|
'name field' => 'filename',
|
43 |
|
|
// the field to display in the summary.
|
44 |
85ad3d82
|
Assos Assos
|
'numeric' => TRUE,
|
45 |
|
|
),
|
46 |
|
|
'filter' => array(
|
47 |
|
|
'handler' => 'views_handler_filter_numeric',
|
48 |
|
|
),
|
49 |
|
|
'sort' => array(
|
50 |
|
|
'handler' => 'views_handler_sort',
|
51 |
|
|
),
|
52 |
|
|
);
|
53 |
|
|
|
54 |
5d12d676
|
Assos Assos
|
// Filename.
|
55 |
85ad3d82
|
Assos Assos
|
$data['file_managed']['filename'] = array(
|
56 |
|
|
'title' => t('Name'),
|
57 |
|
|
'help' => t('The name of the file.'),
|
58 |
|
|
'field' => array(
|
59 |
|
|
'handler' => 'views_handler_field_file',
|
60 |
|
|
'click sortable' => TRUE,
|
61 |
5d12d676
|
Assos Assos
|
),
|
62 |
85ad3d82
|
Assos Assos
|
'sort' => array(
|
63 |
|
|
'handler' => 'views_handler_sort',
|
64 |
|
|
),
|
65 |
|
|
'filter' => array(
|
66 |
|
|
'handler' => 'views_handler_filter_string',
|
67 |
|
|
),
|
68 |
|
|
'argument' => array(
|
69 |
|
|
'handler' => 'views_handler_argument_string',
|
70 |
|
|
),
|
71 |
|
|
);
|
72 |
|
|
|
73 |
5d12d676
|
Assos Assos
|
// URI.
|
74 |
85ad3d82
|
Assos Assos
|
$data['file_managed']['uri'] = array(
|
75 |
|
|
'title' => t('Path'),
|
76 |
|
|
'help' => t('The path of the file.'),
|
77 |
|
|
'field' => array(
|
78 |
|
|
'handler' => 'views_handler_field_file_uri',
|
79 |
|
|
'click sortable' => TRUE,
|
80 |
5d12d676
|
Assos Assos
|
),
|
81 |
85ad3d82
|
Assos Assos
|
'sort' => array(
|
82 |
|
|
'handler' => 'views_handler_sort',
|
83 |
|
|
),
|
84 |
|
|
'filter' => array(
|
85 |
|
|
'handler' => 'views_handler_filter_string',
|
86 |
|
|
),
|
87 |
|
|
'argument' => array(
|
88 |
|
|
'handler' => 'views_handler_argument_string',
|
89 |
|
|
),
|
90 |
|
|
);
|
91 |
|
|
|
92 |
5d12d676
|
Assos Assos
|
// The file's MIME Type.
|
93 |
85ad3d82
|
Assos Assos
|
$data['file_managed']['filemime'] = array(
|
94 |
|
|
'title' => t('Mime type'),
|
95 |
|
|
'help' => t('The mime type of the file.'),
|
96 |
|
|
'field' => array(
|
97 |
|
|
'handler' => 'views_handler_field_file_filemime',
|
98 |
|
|
'click sortable' => TRUE,
|
99 |
5d12d676
|
Assos Assos
|
),
|
100 |
85ad3d82
|
Assos Assos
|
'sort' => array(
|
101 |
|
|
'handler' => 'views_handler_sort',
|
102 |
|
|
),
|
103 |
|
|
'filter' => array(
|
104 |
|
|
'handler' => 'views_handler_filter_string',
|
105 |
|
|
),
|
106 |
|
|
'argument' => array(
|
107 |
|
|
'handler' => 'views_handler_argument_string',
|
108 |
|
|
),
|
109 |
|
|
);
|
110 |
|
|
|
111 |
5d12d676
|
Assos Assos
|
// Extension.
|
112 |
85ad3d82
|
Assos Assos
|
$data['file_managed']['extension'] = array(
|
113 |
|
|
'title' => t('Extension'),
|
114 |
|
|
'help' => t('The extension of the file.'),
|
115 |
4003efde
|
Assos Assos
|
'real field' => 'uri',
|
116 |
85ad3d82
|
Assos Assos
|
'field' => array(
|
117 |
|
|
'handler' => 'views_handler_field_file_extension',
|
118 |
|
|
'click sortable' => FALSE,
|
119 |
5d12d676
|
Assos Assos
|
),
|
120 |
85ad3d82
|
Assos Assos
|
);
|
121 |
|
|
|
122 |
5d12d676
|
Assos Assos
|
// Filesize.
|
123 |
85ad3d82
|
Assos Assos
|
$data['file_managed']['filesize'] = array(
|
124 |
|
|
'title' => t('Size'),
|
125 |
|
|
'help' => t('The size of the file.'),
|
126 |
|
|
'field' => array(
|
127 |
|
|
'handler' => 'views_handler_field_file_size',
|
128 |
|
|
'click sortable' => TRUE,
|
129 |
5d12d676
|
Assos Assos
|
),
|
130 |
85ad3d82
|
Assos Assos
|
'sort' => array(
|
131 |
|
|
'handler' => 'views_handler_sort',
|
132 |
|
|
),
|
133 |
|
|
'filter' => array(
|
134 |
|
|
'handler' => 'views_handler_filter_numeric',
|
135 |
|
|
),
|
136 |
|
|
);
|
137 |
|
|
|
138 |
5d12d676
|
Assos Assos
|
// Status.
|
139 |
85ad3d82
|
Assos Assos
|
$data['file_managed']['status'] = array(
|
140 |
|
|
'title' => t('Status'),
|
141 |
|
|
'help' => t('The status of the file.'),
|
142 |
|
|
'field' => array(
|
143 |
|
|
'handler' => 'views_handler_field_file_status',
|
144 |
|
|
'click sortable' => TRUE,
|
145 |
5d12d676
|
Assos Assos
|
),
|
146 |
85ad3d82
|
Assos Assos
|
'sort' => array(
|
147 |
|
|
'handler' => 'views_handler_sort',
|
148 |
|
|
),
|
149 |
|
|
'filter' => array(
|
150 |
|
|
'handler' => 'views_handler_filter_file_status',
|
151 |
|
|
),
|
152 |
|
|
);
|
153 |
|
|
|
154 |
5d12d676
|
Assos Assos
|
// Timestamp field.
|
155 |
85ad3d82
|
Assos Assos
|
$data['file_managed']['timestamp'] = array(
|
156 |
|
|
'title' => t('Upload date'),
|
157 |
|
|
'help' => t('The date the file was uploaded.'),
|
158 |
|
|
'field' => array(
|
159 |
|
|
'handler' => 'views_handler_field_date',
|
160 |
|
|
'click sortable' => TRUE,
|
161 |
|
|
),
|
162 |
|
|
'sort' => array(
|
163 |
|
|
'handler' => 'views_handler_sort_date',
|
164 |
|
|
),
|
165 |
|
|
'filter' => array(
|
166 |
|
|
'handler' => 'views_handler_filter_date',
|
167 |
|
|
),
|
168 |
|
|
);
|
169 |
|
|
|
170 |
5d12d676
|
Assos Assos
|
// User ID / 'uid'.
|
171 |
85ad3d82
|
Assos Assos
|
$data['file_managed']['uid'] = array(
|
172 |
|
|
'title' => t('User who uploaded'),
|
173 |
|
|
'help' => t('The user that uploaded the file.'),
|
174 |
|
|
'relationship' => array(
|
175 |
|
|
'title' => t('User who uploaded'),
|
176 |
|
|
'label' => t('User who uploaded'),
|
177 |
|
|
'base' => 'users',
|
178 |
|
|
'base field' => 'uid',
|
179 |
|
|
),
|
180 |
|
|
);
|
181 |
|
|
|
182 |
|
|
// ----------------------------------------------------------------------
|
183 |
5d12d676
|
Assos Assos
|
// file_usage table.
|
184 |
85ad3d82
|
Assos Assos
|
$data['file_usage']['table']['group'] = t('File Usage');
|
185 |
|
|
|
186 |
5d12d676
|
Assos Assos
|
// Provide field-type-things to several base tables; on the core files table
|
187 |
|
|
// ("file_managed") so that we can create relationships from files to
|
188 |
|
|
// entities, and then on each core entity type base table so that we can
|
189 |
|
|
// provide general relationships between entities and files.
|
190 |
85ad3d82
|
Assos Assos
|
$data['file_usage']['table']['join'] = array(
|
191 |
5d12d676
|
Assos Assos
|
// Link ourself to the {file_managed} table so we can provide file->entity
|
192 |
|
|
// relationships.
|
193 |
85ad3d82
|
Assos Assos
|
'file_managed' => array(
|
194 |
|
|
'field' => 'fid',
|
195 |
|
|
'left_field' => 'fid',
|
196 |
|
|
),
|
197 |
5d12d676
|
Assos Assos
|
// Link ourself to the {node} table so we can provide node->file
|
198 |
|
|
// relationships.
|
199 |
85ad3d82
|
Assos Assos
|
'node' => array(
|
200 |
|
|
'field' => 'id',
|
201 |
|
|
'left_field' => 'nid',
|
202 |
|
|
'extra' => array(array('field' => 'type', 'value' => 'node')),
|
203 |
|
|
),
|
204 |
5d12d676
|
Assos Assos
|
// Link ourself to the {users} table so we can provide user->file
|
205 |
|
|
// relationships.
|
206 |
85ad3d82
|
Assos Assos
|
'users' => array(
|
207 |
|
|
'field' => 'id',
|
208 |
|
|
'left_field' => 'uid',
|
209 |
|
|
'extra' => array(array('field' => 'type', 'value' => 'user')),
|
210 |
|
|
),
|
211 |
5d12d676
|
Assos Assos
|
// Link ourself to the {comment} table so we can provide comment->file
|
212 |
|
|
// relationships.
|
213 |
85ad3d82
|
Assos Assos
|
'comment' => array(
|
214 |
|
|
'field' => 'id',
|
215 |
|
|
'left_field' => 'cid',
|
216 |
|
|
'extra' => array(array('field' => 'type', 'value' => 'comment')),
|
217 |
|
|
),
|
218 |
5d12d676
|
Assos Assos
|
// Link ourself to the {taxonomy_term_data} table so we can provide
|
219 |
|
|
// taxonomy_term->file relationships.
|
220 |
85ad3d82
|
Assos Assos
|
'taxonomy_term_data' => array(
|
221 |
|
|
'field' => 'id',
|
222 |
|
|
'left_field' => 'tid',
|
223 |
|
|
'extra' => array(array('field' => 'type', 'value' => 'taxonomy_term')),
|
224 |
|
|
),
|
225 |
5d12d676
|
Assos Assos
|
// Link ourself to the {taxonomy_vocabulary} table so we can provide
|
226 |
|
|
// taxonomy_vocabulary->file relationships.
|
227 |
85ad3d82
|
Assos Assos
|
'taxonomy_vocabulary' => array(
|
228 |
|
|
'field' => 'id',
|
229 |
|
|
'left_field' => 'vid',
|
230 |
|
|
'extra' => array(array('field' => 'type', 'value' => 'taxonomy_vocabulary')),
|
231 |
|
|
),
|
232 |
|
|
);
|
233 |
|
|
|
234 |
5d12d676
|
Assos Assos
|
// Provide a relationship between the files table and each entity type, and
|
235 |
|
|
// between each entity type and the files table. Entity->file relationships
|
236 |
|
|
// are type-restricted in the joins declared above, and file->entity
|
237 |
|
|
// relationships are type-restricted in the relationship declarations below.
|
238 |
85ad3d82
|
Assos Assos
|
// Relationships between files and nodes.
|
239 |
|
|
$data['file_usage']['file_to_node'] = array(
|
240 |
|
|
'title' => t('Content'),
|
241 |
|
|
'help' => t('Content that is associated with this file, usually because this file is in a field on the content.'),
|
242 |
5d12d676
|
Assos Assos
|
// Only provide this field/relationship/etc. when the 'file_managed' base
|
243 |
|
|
// table is present.
|
244 |
85ad3d82
|
Assos Assos
|
'skip base' => array('node', 'node_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
|
245 |
|
|
'real field' => 'id',
|
246 |
|
|
'relationship' => array(
|
247 |
|
|
'title' => t('Content'),
|
248 |
|
|
'label' => t('Content'),
|
249 |
|
|
'base' => 'node',
|
250 |
|
|
'base field' => 'nid',
|
251 |
|
|
'relationship field' => 'id',
|
252 |
|
|
'extra' => array(array('table' => 'file_usage', 'field' => 'type', 'operator' => '=', 'value' => 'node')),
|
253 |
|
|
),
|
254 |
|
|
);
|
255 |
|
|
$data['file_usage']['node_to_file'] = array(
|
256 |
|
|
'title' => t('File'),
|
257 |
|
|
'help' => t('A file that is associated with this node, usually because it is in a field on the node.'),
|
258 |
5d12d676
|
Assos Assos
|
// Only provide this field/relationship/etc. when the 'node' base table is
|
259 |
|
|
// present.
|
260 |
85ad3d82
|
Assos Assos
|
'skip base' => array('file_managed', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
|
261 |
|
|
'real field' => 'fid',
|
262 |
|
|
'relationship' => array(
|
263 |
|
|
'title' => t('File'),
|
264 |
|
|
'label' => t('File'),
|
265 |
|
|
'base' => 'file_managed',
|
266 |
|
|
'base field' => 'fid',
|
267 |
|
|
'relationship field' => 'fid',
|
268 |
|
|
),
|
269 |
|
|
);
|
270 |
|
|
|
271 |
|
|
// Relationships between files and users.
|
272 |
|
|
$data['file_usage']['file_to_user'] = array(
|
273 |
|
|
'title' => t('User'),
|
274 |
|
|
'help' => t('A user that is associated with this file, usually because this file is in a field on the user.'),
|
275 |
5d12d676
|
Assos Assos
|
// Only provide this field/relationship/etc. when the 'file_managed' base
|
276 |
|
|
// table is present.
|
277 |
85ad3d82
|
Assos Assos
|
'skip base' => array('node', 'node_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
|
278 |
|
|
'real field' => 'id',
|
279 |
|
|
'relationship' => array(
|
280 |
|
|
'title' => t('User'),
|
281 |
|
|
'label' => t('User'),
|
282 |
|
|
'base' => 'users',
|
283 |
|
|
'base field' => 'uid',
|
284 |
|
|
'relationship field' => 'id',
|
285 |
|
|
'extra' => array(array('table' => 'file_usage', 'field' => 'type', 'operator' => '=', 'value' => 'user')),
|
286 |
|
|
),
|
287 |
|
|
);
|
288 |
|
|
$data['file_usage']['user_to_file'] = array(
|
289 |
|
|
'title' => t('File'),
|
290 |
|
|
'help' => t('A file that is associated with this user, usually because it is in a field on the user.'),
|
291 |
5d12d676
|
Assos Assos
|
// Only provide this field/relationship/etc. when the 'users' base table is
|
292 |
|
|
// present.
|
293 |
85ad3d82
|
Assos Assos
|
'skip base' => array('file_managed', 'node', 'node_revision', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
|
294 |
|
|
'real field' => 'fid',
|
295 |
|
|
'relationship' => array(
|
296 |
|
|
'title' => t('File'),
|
297 |
|
|
'label' => t('File'),
|
298 |
|
|
'base' => 'file_managed',
|
299 |
|
|
'base field' => 'fid',
|
300 |
|
|
'relationship field' => 'fid',
|
301 |
|
|
),
|
302 |
|
|
);
|
303 |
|
|
|
304 |
|
|
// Relationships between files and comments.
|
305 |
|
|
$data['file_usage']['file_to_comment'] = array(
|
306 |
|
|
'title' => t('Comment'),
|
307 |
|
|
'help' => t('A comment that is associated with this file, usually because this file is in a field on the comment.'),
|
308 |
5d12d676
|
Assos Assos
|
// Only provide this field/relationship/etc. when the 'file_managed' base
|
309 |
|
|
// table is present.
|
310 |
85ad3d82
|
Assos Assos
|
'skip base' => array('node', 'node_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
|
311 |
|
|
'real field' => 'id',
|
312 |
|
|
'relationship' => array(
|
313 |
|
|
'title' => t('Comment'),
|
314 |
|
|
'label' => t('Comment'),
|
315 |
|
|
'base' => 'comment',
|
316 |
|
|
'base field' => 'cid',
|
317 |
|
|
'relationship field' => 'id',
|
318 |
|
|
'extra' => array(array('table' => 'file_usage', 'field' => 'type', 'operator' => '=', 'value' => 'comment')),
|
319 |
|
|
),
|
320 |
|
|
);
|
321 |
|
|
$data['file_usage']['comment_to_file'] = array(
|
322 |
|
|
'title' => t('File'),
|
323 |
|
|
'help' => t('A file that is associated with this comment, usually because it is in a field on the comment.'),
|
324 |
5d12d676
|
Assos Assos
|
// Only provide this field/relationship/etc. when the 'comment' base table
|
325 |
|
|
// is present.
|
326 |
85ad3d82
|
Assos Assos
|
'skip base' => array('file_managed', 'node', 'node_revision', 'users', 'taxonomy_term_data', 'taxonomy_vocabulary'),
|
327 |
|
|
'real field' => 'fid',
|
328 |
|
|
'relationship' => array(
|
329 |
|
|
'title' => t('File'),
|
330 |
|
|
'label' => t('File'),
|
331 |
|
|
'base' => 'file_managed',
|
332 |
|
|
'base field' => 'fid',
|
333 |
|
|
'relationship field' => 'fid',
|
334 |
|
|
),
|
335 |
|
|
);
|
336 |
|
|
|
337 |
|
|
// Relationships between files and taxonomy_terms.
|
338 |
|
|
$data['file_usage']['file_to_taxonomy_term'] = array(
|
339 |
|
|
'title' => t('Taxonomy Term'),
|
340 |
|
|
'help' => t('A taxonomy term that is associated with this file, usually because this file is in a field on the taxonomy term.'),
|
341 |
5d12d676
|
Assos Assos
|
// Only provide this field/relationship/etc. when the 'file_managed' base
|
342 |
|
|
// table is present.
|
343 |
85ad3d82
|
Assos Assos
|
'skip base' => array('node', 'node_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
|
344 |
|
|
'real field' => 'id',
|
345 |
|
|
'relationship' => array(
|
346 |
|
|
'title' => t('Taxonomy Term'),
|
347 |
|
|
'label' => t('Taxonomy Term'),
|
348 |
|
|
'base' => 'taxonomy_term_data',
|
349 |
|
|
'base field' => 'tid',
|
350 |
|
|
'relationship field' => 'id',
|
351 |
|
|
'extra' => array(array('table' => 'file_usage', 'field' => 'type', 'operator' => '=', 'value' => 'taxonomy_term')),
|
352 |
|
|
),
|
353 |
|
|
);
|
354 |
|
|
$data['file_usage']['taxonomy_term_to_file'] = array(
|
355 |
|
|
'title' => t('File'),
|
356 |
|
|
'help' => t('A file that is associated with this taxonomy term, usually because it is in a field on the taxonomy term.'),
|
357 |
5d12d676
|
Assos Assos
|
// Only provide this field/relationship/etc. when the 'taxonomy_term_data'
|
358 |
|
|
// base table is present.
|
359 |
85ad3d82
|
Assos Assos
|
'skip base' => array('file_managed', 'node', 'node_revision', 'users', 'comment', 'taxonomy_vocabulary'),
|
360 |
|
|
'real field' => 'fid',
|
361 |
|
|
'relationship' => array(
|
362 |
|
|
'title' => t('File'),
|
363 |
|
|
'label' => t('File'),
|
364 |
|
|
'base' => 'file_managed',
|
365 |
|
|
'base field' => 'fid',
|
366 |
|
|
'relationship field' => 'fid',
|
367 |
|
|
),
|
368 |
|
|
);
|
369 |
|
|
|
370 |
|
|
// Relationships between files and taxonomy_vocabulary items.
|
371 |
|
|
$data['file_usage']['file_to_taxonomy_vocabulary'] = array(
|
372 |
|
|
'title' => t('Taxonomy Vocabulary'),
|
373 |
|
|
'help' => t('A taxonomy vocabulary that is associated with this file, usually because this file is in a field on the taxonomy vocabulary.'),
|
374 |
5d12d676
|
Assos Assos
|
// Only provide this field/relationship/etc. when the 'file_managed' base
|
375 |
|
|
// table is present.
|
376 |
85ad3d82
|
Assos Assos
|
'skip base' => array('node', 'node_revision', 'users', 'comment', 'taxonomy_term_data', 'taxonomy_vocabulary'),
|
377 |
|
|
'real field' => 'id',
|
378 |
|
|
'relationship' => array(
|
379 |
|
|
'title' => t('Taxonomy Vocabulary'),
|
380 |
|
|
'label' => t('Taxonomy Vocabulary'),
|
381 |
|
|
'base' => 'taxonomy_vocabulary',
|
382 |
|
|
'base field' => 'vid',
|
383 |
|
|
'relationship field' => 'id',
|
384 |
|
|
'extra' => array(array('table' => 'file_usage', 'field' => 'type', 'operator' => '=', 'value' => 'taxonomy_vocabulary')),
|
385 |
|
|
),
|
386 |
|
|
);
|
387 |
|
|
$data['file_usage']['taxonomy_vocabulary_to_file'] = array(
|
388 |
|
|
'title' => t('File'),
|
389 |
|
|
'help' => t('A file that is associated with this taxonomy vocabulary, usually because it is in a field on the taxonomy vocabulary.'),
|
390 |
5d12d676
|
Assos Assos
|
// Only provide this field/relationship/etc. when the 'taxonomy_vocabulary'
|
391 |
|
|
// base table is present.
|
392 |
85ad3d82
|
Assos Assos
|
'skip base' => array('file_managed', 'node', 'node_revision', 'users', 'comment', 'taxonomy_term_data'),
|
393 |
|
|
'real field' => 'fid',
|
394 |
|
|
'relationship' => array(
|
395 |
|
|
'title' => t('File'),
|
396 |
|
|
'label' => t('File'),
|
397 |
|
|
'base' => 'file_managed',
|
398 |
|
|
'base field' => 'fid',
|
399 |
|
|
'relationship field' => 'fid',
|
400 |
|
|
),
|
401 |
|
|
);
|
402 |
|
|
|
403 |
5d12d676
|
Assos Assos
|
// Provide basic fields from the {file_usage} table to all of the base tables
|
404 |
|
|
// we've declared joins to (because there is no 'skip base' property on these
|
405 |
|
|
// fields).
|
406 |
85ad3d82
|
Assos Assos
|
$data['file_usage']['module'] = array(
|
407 |
|
|
'title' => t('Module'),
|
408 |
|
|
'help' => t('The module managing this file relationship.'),
|
409 |
|
|
'field' => array(
|
410 |
|
|
'handler' => 'views_handler_field',
|
411 |
|
|
'click sortable' => TRUE,
|
412 |
5d12d676
|
Assos Assos
|
),
|
413 |
85ad3d82
|
Assos Assos
|
'filter' => array(
|
414 |
|
|
'handler' => 'views_handler_filter_string',
|
415 |
|
|
),
|
416 |
|
|
'argument' => array(
|
417 |
|
|
'handler' => 'views_handler_argument_string',
|
418 |
|
|
),
|
419 |
|
|
'sort' => array(
|
420 |
|
|
'handler' => 'views_handler_sort',
|
421 |
|
|
),
|
422 |
|
|
);
|
423 |
|
|
$data['file_usage']['type'] = array(
|
424 |
|
|
'title' => t('Entity type'),
|
425 |
|
|
'help' => t('The type of entity that is related to the file.'),
|
426 |
|
|
'field' => array(
|
427 |
|
|
'handler' => 'views_handler_field',
|
428 |
|
|
'click sortable' => TRUE,
|
429 |
5d12d676
|
Assos Assos
|
),
|
430 |
85ad3d82
|
Assos Assos
|
'filter' => array(
|
431 |
|
|
'handler' => 'views_handler_filter_string',
|
432 |
|
|
),
|
433 |
|
|
'argument' => array(
|
434 |
|
|
'handler' => 'views_handler_argument_string',
|
435 |
|
|
),
|
436 |
|
|
'sort' => array(
|
437 |
|
|
'handler' => 'views_handler_sort',
|
438 |
|
|
),
|
439 |
|
|
);
|
440 |
|
|
$data['file_usage']['id'] = array(
|
441 |
|
|
'title' => t('Entity ID'),
|
442 |
|
|
'help' => t('The ID of the entity that is related to the file.'),
|
443 |
|
|
'field' => array(
|
444 |
|
|
'handler' => 'views_handler_field_numeric',
|
445 |
|
|
'click sortable' => TRUE,
|
446 |
|
|
),
|
447 |
|
|
'argument' => array(
|
448 |
|
|
'handler' => 'views_handler_argument_numeric',
|
449 |
|
|
),
|
450 |
|
|
'filter' => array(
|
451 |
|
|
'handler' => 'views_handler_filter_numeric',
|
452 |
|
|
),
|
453 |
|
|
'sort' => array(
|
454 |
|
|
'handler' => 'views_handler_sort',
|
455 |
|
|
),
|
456 |
|
|
);
|
457 |
|
|
$data['file_usage']['count'] = array(
|
458 |
|
|
'title' => t('Use count'),
|
459 |
|
|
'help' => t('The number of times the file is used by this entity.'),
|
460 |
|
|
'field' => array(
|
461 |
|
|
'handler' => 'views_handler_field_numeric',
|
462 |
|
|
'click sortable' => TRUE,
|
463 |
5d12d676
|
Assos Assos
|
),
|
464 |
85ad3d82
|
Assos Assos
|
'filter' => array(
|
465 |
|
|
'handler' => 'views_handler_filter_numeric',
|
466 |
|
|
),
|
467 |
|
|
'sort' => array(
|
468 |
|
|
'handler' => 'views_handler_sort',
|
469 |
|
|
),
|
470 |
|
|
);
|
471 |
|
|
|
472 |
|
|
// ----------------------------------------------------------------------
|
473 |
5d12d676
|
Assos Assos
|
// System table.
|
474 |
85ad3d82
|
Assos Assos
|
$data['system']['table']['group'] = t('System');
|
475 |
|
|
|
476 |
5d12d676
|
Assos Assos
|
// Advertise this table as a possible base table.
|
477 |
85ad3d82
|
Assos Assos
|
$data['system']['table']['base'] = array(
|
478 |
|
|
'field' => 'filename',
|
479 |
|
|
'title' => t('Module/Theme/Theme engine'),
|
480 |
|
|
'help' => t('Modules/Themes/Theme engines in your codebase.'),
|
481 |
|
|
);
|
482 |
|
|
|
483 |
5d12d676
|
Assos Assos
|
// Fields.
|
484 |
|
|
// - filename.
|
485 |
85ad3d82
|
Assos Assos
|
$data['system']['filename'] = array(
|
486 |
|
|
'title' => t('Module/Theme/Theme engine filename'),
|
487 |
|
|
'help' => t('The path of the primary file for this item, relative to the Drupal root; e.g. modules/node/node.module.'),
|
488 |
|
|
'field' => array(
|
489 |
|
|
'handler' => 'views_handler_field',
|
490 |
|
|
'click sortable' => TRUE,
|
491 |
|
|
),
|
492 |
|
|
'argument' => array(
|
493 |
5d12d676
|
Assos Assos
|
// The field to display in the summary.
|
494 |
85ad3d82
|
Assos Assos
|
'handler' => 'views_handler_argument_string',
|
495 |
5d12d676
|
Assos Assos
|
'name field' => 'filename',
|
496 |
85ad3d82
|
Assos Assos
|
),
|
497 |
|
|
'filter' => array(
|
498 |
|
|
'handler' => 'views_handler_filter_string',
|
499 |
|
|
),
|
500 |
|
|
'sort' => array(
|
501 |
|
|
'handler' => 'views_handler_sort',
|
502 |
|
|
),
|
503 |
|
|
);
|
504 |
5d12d676
|
Assos Assos
|
// - name.
|
505 |
85ad3d82
|
Assos Assos
|
$data['system']['name'] = array(
|
506 |
|
|
'title' => t('Module/Theme/Theme engine name'),
|
507 |
|
|
'help' => t('The name of the item; e.g. node.'),
|
508 |
|
|
'field' => array(
|
509 |
|
|
'handler' => 'views_handler_field',
|
510 |
|
|
'click sortable' => TRUE,
|
511 |
|
|
),
|
512 |
|
|
'argument' => array(
|
513 |
5d12d676
|
Assos Assos
|
// The field to display in the summary.
|
514 |
85ad3d82
|
Assos Assos
|
'handler' => 'views_handler_argument_string',
|
515 |
5d12d676
|
Assos Assos
|
'name field' => 'name',
|
516 |
85ad3d82
|
Assos Assos
|
),
|
517 |
|
|
'filter' => array(
|
518 |
|
|
'handler' => 'views_handler_filter_string',
|
519 |
|
|
),
|
520 |
|
|
'sort' => array(
|
521 |
|
|
'handler' => 'views_handler_sort',
|
522 |
|
|
),
|
523 |
|
|
);
|
524 |
5d12d676
|
Assos Assos
|
// - type.
|
525 |
85ad3d82
|
Assos Assos
|
$data['system']['type'] = array(
|
526 |
|
|
'title' => t('Type'),
|
527 |
|
|
'help' => t('The type of the item, either module, theme, or theme_engine.'),
|
528 |
|
|
'field' => array(
|
529 |
|
|
'handler' => 'views_handler_field',
|
530 |
|
|
'click sortable' => TRUE,
|
531 |
|
|
),
|
532 |
|
|
'argument' => array(
|
533 |
5d12d676
|
Assos Assos
|
// The field to display in the summary.
|
534 |
85ad3d82
|
Assos Assos
|
'handler' => 'views_handler_argument_string',
|
535 |
5d12d676
|
Assos Assos
|
'name field' => 'type',
|
536 |
85ad3d82
|
Assos Assos
|
),
|
537 |
|
|
'filter' => array(
|
538 |
|
|
'handler' => 'views_handler_filter_system_type',
|
539 |
|
|
),
|
540 |
|
|
'sort' => array(
|
541 |
|
|
'handler' => 'views_handler_sort',
|
542 |
|
|
),
|
543 |
|
|
);
|
544 |
5d12d676
|
Assos Assos
|
// - status.
|
545 |
85ad3d82
|
Assos Assos
|
$data['system']['status'] = array(
|
546 |
|
|
'title' => t('Status'),
|
547 |
|
|
'help' => t('Boolean indicating whether or not this item is enabled.'),
|
548 |
|
|
'field' => array(
|
549 |
|
|
'handler' => 'views_handler_field_boolean',
|
550 |
|
|
'click sortable' => TRUE,
|
551 |
|
|
),
|
552 |
|
|
'argument' => array(
|
553 |
5d12d676
|
Assos Assos
|
// The field to display in the summary.
|
554 |
85ad3d82
|
Assos Assos
|
'handler' => 'views_handler_argument_numeric',
|
555 |
5d12d676
|
Assos Assos
|
'name field' => 'status',
|
556 |
85ad3d82
|
Assos Assos
|
),
|
557 |
|
|
'filter' => array(
|
558 |
|
|
'handler' => 'views_handler_filter_boolean_operator',
|
559 |
|
|
),
|
560 |
|
|
'sort' => array(
|
561 |
|
|
'handler' => 'views_handler_sort',
|
562 |
|
|
),
|
563 |
|
|
);
|
564 |
5d12d676
|
Assos Assos
|
// - schema version.
|
565 |
85ad3d82
|
Assos Assos
|
$data['system']['schema_version'] = array(
|
566 |
|
|
'title' => t('Schema version'),
|
567 |
|
|
'help' => t("The module's database schema version number. -1 if the module is not installed (its tables do not exist); 0 or the largest N of the module's hook_update_N() function that has either been run or existed when the module was first installed."),
|
568 |
|
|
'field' => array(
|
569 |
|
|
'handler' => 'views_handler_field_numeric',
|
570 |
|
|
'click sortable' => TRUE,
|
571 |
|
|
),
|
572 |
|
|
'argument' => array(
|
573 |
5d12d676
|
Assos Assos
|
// The field to display in the summary.
|
574 |
85ad3d82
|
Assos Assos
|
'handler' => 'views_handler_argument_numeric',
|
575 |
5d12d676
|
Assos Assos
|
'name field' => 'schema_version',
|
576 |
85ad3d82
|
Assos Assos
|
),
|
577 |
|
|
'filter' => array(
|
578 |
|
|
'handler' => 'views_handler_filter_numeric',
|
579 |
|
|
),
|
580 |
|
|
'sort' => array(
|
581 |
|
|
'handler' => 'views_handler_sort',
|
582 |
|
|
),
|
583 |
|
|
);
|
584 |
|
|
|
585 |
|
|
return $data;
|
586 |
|
|
}
|
587 |
|
|
|
588 |
5d12d676
|
Assos Assos
|
/**
|
589 |
|
|
* Obtain a human readable label for a file's status.
|
590 |
|
|
*
|
591 |
|
|
* @param int $choice
|
592 |
|
|
* Indicate the file's status, expected to be either '0' for a temporary file
|
593 |
|
|
* or the value of FILE_STATUS_PERMANENT for a permanent file; any other value
|
594 |
|
|
* will be indicated as being 'Unknown'.
|
595 |
|
|
*
|
596 |
|
|
* @return string
|
597 |
|
|
* A string representing the file's status.
|
598 |
|
|
*/
|
599 |
85ad3d82
|
Assos Assos
|
function _views_file_status($choice = NULL) {
|
600 |
|
|
$status = array(
|
601 |
|
|
0 => t('Temporary'),
|
602 |
|
|
FILE_STATUS_PERMANENT => t('Permanent'),
|
603 |
|
|
);
|
604 |
|
|
|
605 |
|
|
if (isset($choice)) {
|
606 |
|
|
return isset($status[$choice]) ? $status[$choice] : t('Unknown');
|
607 |
|
|
}
|
608 |
|
|
|
609 |
|
|
return $status;
|
610 |
|
|
} |