Projet

Général

Profil

Paste
Télécharger (1,09 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / modules / node / views_handler_argument_node_type.inc @ 5d12d676

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

    
13
  /**
14
   * {@inheritdoc}
15
   */
16
  public function construct() {
17
    parent::construct('type');
18
  }
19

    
20
  /**
21
   * Override the behavior of summary_name(). Get the user friendly version
22
   * of the node type.
23
   */
24
  public function summary_name($data) {
25
    return $this->node_type($data->{$this->name_alias});
26
  }
27

    
28
  /**
29
   * Override the behavior of title(). Get the user friendly version of the
30
   * node type.
31
   */
32
  public function title() {
33
    return $this->node_type($this->argument);
34
  }
35

    
36
  /**
37
   * Get the friendly version of a content type's name.
38
   *
39
   * @param string $type
40
   *   The content type to check.
41
   *
42
   * @return string
43
   *   The system friendly version of a content type's name.
44
   */
45
  public function node_type($type) {
46
    $output = node_type_get_name($type);
47
    if (empty($output)) {
48
      $output = t('Unknown content type');
49
    }
50
    return check_plain($output);
51
  }
52

    
53
}