Projet

Général

Profil

Paste
Télécharger (982 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / modules / filter / views_handler_field_filter_format_name.inc @ 13755f8d

1
<?php
2

    
3
/**
4
 * @file
5
 * Definition of views_handler_field_filter_format_name.
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
  function construct() {
15
    parent::construct();
16
    // Be explicit about the table we are using.
17
    $this->additional_fields['name'] = array('table' => 'filter_formats', 'field' => 'name');
18
  }
19

    
20
  function query() {
21
    $this->ensure_my_table();
22
    $this->add_additional_fields();
23
  }
24

    
25
  function render($values) {
26
    $format_name = $this->get_value($values, 'name');
27
    if (!$format_name) {
28
      // Default or invalid input format.
29
      // filter_formats() will reliably return the default format even if the
30
      // current user is unprivileged.
31
      $format = filter_formats(filter_default_format());
32
      return $this->sanitize_value($format->name);
33
    }
34
    return $this->sanitize_value($format_name);
35
  }
36
}