1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Definition of views_handler_argument_file_type.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
/**
|
9 |
|
|
* Argument handler to accept a file type.
|
10 |
|
|
*/
|
11 |
|
|
class views_handler_argument_file_type extends views_handler_argument_string {
|
12 |
|
|
|
13 |
|
|
/**
|
14 |
|
|
* Override the behavior of summary_name(). Get the user friendly version
|
15 |
|
|
* of the file type.
|
16 |
|
|
*/
|
17 |
|
|
function summary_name($data) {
|
18 |
|
|
return $this->file_type($data->{$this->name_alias});
|
19 |
|
|
}
|
20 |
|
|
|
21 |
|
|
/**
|
22 |
|
|
* Override the behavior of title(). Get the user friendly version of the
|
23 |
|
|
* file type.
|
24 |
|
|
*/
|
25 |
|
|
function title() {
|
26 |
|
|
return $this->file_type($this->argument);
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
/**
|
30 |
|
|
* Helper function to return the human-readable type of the file.
|
31 |
|
|
*/
|
32 |
|
|
function file_type($type) {
|
33 |
|
|
$output = file_entity_type_get_name($type);
|
34 |
|
|
if (empty($output)) {
|
35 |
|
|
$output = t('Unknown file type');
|
36 |
|
|
}
|
37 |
|
|
return check_plain($output);
|
38 |
|
|
}
|
39 |
|
|
} |