summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/filter/views_handler_field_filter_format_name.inc
blob: 0a7bf3b86817408945d6051119f8694b11b17ed0 (plain)
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
<?php

/**
 * @file
 * Definition of views_handler_field_filter_format_name.
 */

/**
 * Field handler to output the name of an input format.
 *
 * @ingroup views_field_handlers
 */
class views_handler_field_filter_format_name extends views_handler_field {
  function construct() {
    parent::construct();
    // Be explicit about the table we are using.
    $this->additional_fields['name'] = array('table' => 'filter_formats', 'field' => 'name');
  }

  function query() {
    $this->ensure_my_table();
    $this->add_additional_fields();
  }

  function render($values) {
    $format_name = $this->get_value($values, 'name');
    if (!$format_name) {
      // Default or invalid input format.
      // filter_formats() will reliably return the default format even if the
      // current user is unprivileged.
      $format = filter_formats(filter_default_format());
      return $this->sanitize_value($format->name);
    }
    return $this->sanitize_value($format_name);
  }
}