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_filter_boolean_operator.inc
22 22
 * @ingroup views_filter_handlers
23 23
 */
24 24
class views_handler_filter_boolean_operator extends views_handler_filter {
25
  // exposed filter options
26
  var $always_multiple = TRUE;
27
  // Don't display empty space where the operator would be.
28
  var $no_operator = TRUE;
29
  // Whether to accept NULL as a false value or not
30
  var $accept_null = FALSE;
31

  
32
  function construct() {
25

  
26
  /**
27
   * Exposed filter options.
28
   */
29
  public $always_multiple = TRUE;
30

  
31
  /**
32
   * Don't display empty space where the operator would be.
33
   */
34
  public $no_operator = TRUE;
35

  
36
  /**
37
   * Whether to accept NULL as a false value or not.
38
   */
39
  public $accept_null = FALSE;
40

  
41
  /**
42
   * {@inheritdoc}
43
   */
44
  public function construct() {
33 45
    $this->value_value = t('True');
34 46
    if (isset($this->definition['label'])) {
35 47
      $this->value_value = $this->definition['label'];
......
37 49
    if (isset($this->definition['accept null'])) {
38 50
      $this->accept_null = (bool) $this->definition['accept null'];
39 51
    }
40
    else if (isset($this->definition['accept_null'])) {
52
    elseif (isset($this->definition['accept_null'])) {
41 53
      $this->accept_null = (bool) $this->definition['accept_null'];
42 54
    }
43 55
    $this->value_options = NULL;
......
56 68
   * dynamic for some reason, child classes should use a guard to reduce
57 69
   * database hits as much as possible.
58 70
   */
59
  function get_value_options() {
71
  public function get_value_options() {
60 72
    if (isset($this->definition['type'])) {
61 73
      if ($this->definition['type'] == 'yes-no') {
62 74
        $this->value_options = array(1 => t('Yes'), 0 => t('No'));
......
75 87
    }
76 88
  }
77 89

  
78
  function option_definition() {
90
  /**
91
   * {@inheritdoc}
92
   */
93
  public function option_definition() {
79 94
    $options = parent::option_definition();
80 95

  
81 96
    $options['value']['default'] = FALSE;
......
83 98
    return $options;
84 99
  }
85 100

  
86
  function operator_form(&$form, &$form_state) {
101
  /**
102
   * {@inheritdoc}
103
   */
104
  public function operator_form(&$form, &$form_state) {
87 105
    $form['operator'] = array();
88 106
  }
89 107

  
90
  function value_form(&$form, &$form_state) {
108
  /**
109
   * {@inheritdoc}
110
   */
111
  public function value_form(&$form, &$form_state) {
91 112
    if (empty($this->value_options)) {
92 113
      // Initialize the array of possible values for this filter.
93 114
      $this->get_value_options();
......
122 143
    }
123 144
  }
124 145

  
125
  function value_validate($form, &$form_state) {
146
  /**
147
   * {@inheritdoc}
148
   */
149
  public function value_validate($form, &$form_state) {
126 150
    if ($form_state['values']['options']['value'] == 'All' && !empty($form_state['values']['options']['expose']['required'])) {
127 151
      form_set_error('value', t('You must select a value unless this is an non-required exposed filter.'));
128 152
    }
129 153
  }
130 154

  
131
  function admin_summary() {
155
  /**
156
   * {@inheritdoc}
157
   */
158
  public function admin_summary() {
132 159
    if ($this->is_a_group()) {
133 160
      return t('grouped');
134 161
    }
......
145 172
    return $this->value_options[!empty($this->value)];
146 173
  }
147 174

  
148
  function expose_options() {
175
  /**
176
   * {@inheritdoc}
177
   */
178
  public function expose_options() {
149 179
    parent::expose_options();
150 180
    $this->options['expose']['operator_id'] = '';
151 181
    $this->options['expose']['label'] = $this->value_value;
152 182
    $this->options['expose']['required'] = TRUE;
153 183
  }
154 184

  
155
  function query() {
185
  /**
186
   * {@inheritdoc}
187
   */
188
  public function query() {
156 189
    $this->ensure_my_table();
157 190
    $field = "$this->table_alias.$this->real_field";
158 191

  
......
176 209
      }
177 210
    }
178 211
  }
212

  
179 213
}

Formats disponibles : Unified diff