1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Contains .
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Field handler to output the name of an input format.
|
10
|
*
|
11
|
* @ingroup views_field_handlers
|
12
|
*/
|
13
|
class views_handler_field_filter_format_name extends views_handler_field {
|
14
|
|
15
|
/**
|
16
|
* {@inheritdoc}
|
17
|
*/
|
18
|
public function construct() {
|
19
|
parent::construct();
|
20
|
// Be explicit about the table we are using.
|
21
|
$this->additional_fields['name'] = array('table' => 'filter_formats', 'field' => 'name');
|
22
|
}
|
23
|
|
24
|
/**
|
25
|
* {@inheritdoc}
|
26
|
*/
|
27
|
public function query() {
|
28
|
$this->ensure_my_table();
|
29
|
$this->add_additional_fields();
|
30
|
}
|
31
|
|
32
|
/**
|
33
|
* {@inheritdoc}
|
34
|
*/
|
35
|
public function render($values) {
|
36
|
$format_name = $this->get_value($values, 'name');
|
37
|
if (!$format_name) {
|
38
|
// Default or invalid input format.
|
39
|
// filter_formats() will reliably return the default format even if the
|
40
|
// current user is unprivileged.
|
41
|
$format = filter_formats(filter_default_format());
|
42
|
return $this->sanitize_value($format->name);
|
43
|
}
|
44
|
return $this->sanitize_value($format_name);
|
45
|
}
|
46
|
|
47
|
}
|