Projet

Général

Profil

Révision 5d12d676

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/views/handlers/views_handler_field_machine_name.inc
10 10
 * @ingroup views_field_handlers
11 11
 *
12 12
 * Definition items:
13
 * - options callback: The function to call in order to generate the value options. If omitted, the options 'Yes' and 'No' will be used.
13
 * - options callback: The function to call in order to generate the value
14
 *   options. If omitted, the options 'Yes' and 'No' will be used.
14 15
 * - options arguments: An array of arguments to pass to the options callback.
15 16
 */
16 17
class views_handler_field_machine_name extends views_handler_field {
18

  
17 19
  /**
18 20
   * @var array Stores the available options.
19 21
   */
20
  var $value_options;
22
  public $value_options;
21 23

  
22
  function get_value_options() {
24
  /**
25
   * {@inheritdoc}
26
   */
27
  public function get_value_options() {
23 28
    if (isset($this->value_options)) {
24 29
      return;
25 30
    }
......
37 42
    }
38 43
  }
39 44

  
40
  function option_definition() {
45
  /**
46
   * {@inheritdoc}
47
   */
48
  public function option_definition() {
41 49
    $options = parent::option_definition();
42 50
    $options['machine_name'] = array('default' => FALSE, 'bool' => TRUE);
43 51

  
44 52
    return $options;
45 53
  }
46 54

  
47
  function options_form(&$form, &$form_state) {
55
  /**
56
   * {@inheritdoc}
57
   */
58
  public function options_form(&$form, &$form_state) {
48 59
    parent::options_form($form, $form_state);
49 60

  
50 61
    $form['machine_name'] = array(
......
55 66
    );
56 67
  }
57 68

  
58
  function pre_render(&$values) {
69
  /**
70
   * {@inheritdoc}
71
   */
72
  public function pre_render(&$values) {
59 73
    $this->get_value_options();
60 74
  }
61 75

  
62
  function render($values) {
76
  /**
77
   * {@inheritdoc}
78
   */
79
  public function render($values) {
63 80
    $value = $values->{$this->field_alias};
64 81
    if (!empty($this->options['machine_name']) || !isset($this->value_options[$value])) {
65 82
      $result = check_plain($value);
......
70 87

  
71 88
    return $result;
72 89
  }
90

  
73 91
}

Formats disponibles : Unified diff