Projet

Général

Profil

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

root / drupal7 / sites / all / modules / views / modules / node / views_handler_argument_node_type.inc @ 13755f8d

1
<?php
2

    
3
/**
4
 * @file
5
 * Definition of views_handler_argument_node_type.
6
 */
7

    
8
/**
9
 * Argument handler to accept a node type.
10
 */
11
class views_handler_argument_node_type extends views_handler_argument_string {
12
  function construct() {
13
    parent::construct('type');
14
  }
15

    
16
  /**
17
   * Override the behavior of summary_name(). Get the user friendly version
18
   * of the node type.
19
   */
20
  function summary_name($data) {
21
    return $this->node_type($data->{$this->name_alias});
22
  }
23

    
24
  /**
25
   * Override the behavior of title(). Get the user friendly version of the
26
   * node type.
27
   */
28
  function title() {
29
    return $this->node_type($this->argument);
30
  }
31

    
32
  function node_type($type) {
33
    $output = node_type_get_name($type);
34
    if (empty($output)) {
35
      $output = t('Unknown content type');
36
    }
37
    return check_plain($output);
38
  }
39
}