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/plugins/views_plugin_exposed_form.inc
23 23
  /**
24 24
   * Initialize the plugin.
25 25
   *
26
   * @param $view
26
   * @param object $view
27 27
   *   The view object.
28
   * @param $display
28
   * @param object $display
29 29
   *   The display handler.
30
   * @param array $options
31
   *   Any additional options that are being added.
30 32
   */
31
  function init(&$view, &$display, $options = array()) {
33
  public function init(&$view, &$display, $options = array()) {
32 34
    $this->view = &$view;
33 35
    $this->display = &$display;
34 36

  
35 37
    $this->unpack_options($this->options, $options);
36 38
  }
37 39

  
38
  function option_definition() {
40
  /**
41
   * {@inheritdoc}
42
   */
43
  public function option_definition() {
39 44
    $options = parent::option_definition();
40 45
    $options['submit_button'] = array('default' => 'Apply', 'translatable' => TRUE);
41 46
    $options['reset_button'] = array('default' => FALSE, 'bool' => TRUE);
......
49 54
    return $options;
50 55
  }
51 56

  
52
  function options_form(&$form, &$form_state) {
57
  /**
58
   * {@inheritdoc}
59
   */
60
  public function options_form(&$form, &$form_state) {
53 61
    parent::options_form($form, $form_state);
54 62
    $form['submit_button'] = array(
55 63
      '#type' => 'textfield',
......
135 143
   * also assign data to the appropriate handlers for use in building the
136 144
   * query.
137 145
   */
138
  function render_exposed_form($block = FALSE) {
146
  public function render_exposed_form($block = FALSE) {
139 147
    // Deal with any exposed filters we may have, before building.
140 148
    $form_state = array(
141 149
      'view' => &$this->view,
......
169 177
    }
170 178
  }
171 179

  
172
  function query() {
180
  /**
181
   * {@inheritdoc}
182
   */
183
  public function query() {
173 184
    $view = $this->view;
174 185
    $exposed_data = isset($view->exposed_data) ? $view->exposed_data : array();
175 186
    $sort_by = isset($exposed_data['sort_by']) ? $exposed_data['sort_by'] : NULL;
......
182 193
          if (!$sort->is_exposed()) {
183 194
            $sort->query();
184 195
          }
185
          else if ($key == $sort_by) {
196
          elseif ($key == $sort_by) {
186 197
            if (isset($exposed_data['sort_order']) && in_array($exposed_data['sort_order'], array('ASC', 'DESC'))) {
187 198
              $sort->options['order'] = $exposed_data['sort_order'];
188 199
            }
......
194 205
    }
195 206
  }
196 207

  
197
  function pre_render($values) { }
208
  /**
209
   * {@inheritdoc}
210
   */
211
  public function pre_render($values) {
212
  }
198 213

  
199
  function post_render(&$output) { }
214
  /**
215
   * {@inheritdoc}
216
   */
217
  public function post_render(&$output) {
218
  }
200 219

  
201
  function pre_execute() { }
220
  /**
221
   * {@inheritdoc}
222
   */
223
  public function pre_execute() {
224
  }
202 225

  
203
  function post_execute() { }
226
  /**
227
   * {@inheritdoc}
228
   */
229
  public function post_execute() {
230
  }
204 231

  
205
  function exposed_form_alter(&$form, &$form_state) {
232
  /**
233
   * {@inheritdoc}
234
   */
235
  public function exposed_form_alter(&$form, &$form_state) {
206 236
    if (!empty($this->options['reset_button'])) {
207 237
      $form['reset'] = array(
208 238
        '#value' => $this->options['reset_button_label'],
......
231 261
      );
232 262
      if (isset($form_state['input']['sort_by']) && isset($this->view->sort[$form_state['input']['sort_by']])) {
233 263
        $default_sort_order = $this->view->sort[$form_state['input']['sort_by']]->options['order'];
234
      } else {
264
      }
265
      else {
235 266
        $first_sort = reset($this->view->sort);
236 267
        $default_sort_order = $first_sort->options['order'];
237 268
      }
......
275 306
    }
276 307
  }
277 308

  
278
  function exposed_form_validate(&$form, &$form_state) {
309
  /**
310
   * {@inheritdoc}
311
   */
312
  public function exposed_form_validate(&$form, &$form_state) {
279 313
    if (isset($form_state['pager_plugin'])) {
280 314
      $form_state['pager_plugin']->exposed_form_validate($form, $form_state);
281 315
    }
......
284 318
  /**
285 319
  * This function is executed when exposed form is submited.
286 320
  *
287
  * @param $form
321
  * @param array $form
288 322
  *   Nested array of form elements that comprise the form.
289
  * @param $form_state
323
  * @param array $form_state
290 324
  *   A keyed array containing the current state of the form.
291
  * @param $exclude
292
  *   Nested array of keys to exclude of insert into
293
  *   $view->exposed_raw_input
325
  * @param array $exclude
326
  *   Nested array of keys to exclude of insert into $view->exposed_raw_input.
294 327
  */
295
  function exposed_form_submit(&$form, &$form_state, &$exclude) {
328
  public function exposed_form_submit(&$form, &$form_state, &$exclude) {
296 329
    if (!empty($form_state['values']['op']) && $form_state['values']['op'] == $this->options['reset_button_label']) {
297 330
      $this->reset_form($form, $form_state);
298 331
    }
......
302 335
    }
303 336
  }
304 337

  
305
  function reset_form(&$form, &$form_state) {
338
  /**
339
   * {@inheritdoc}
340
   */
341
  public function reset_form(&$form, &$form_state) {
306 342
    // _SESSION is not defined for users who are not logged in.
307 343

  
308 344
    // If filters are not overridden, store the 'remember' settings on the
......
327 363
    $form_state['redirect'] = current_path();
328 364
    $form_state['values'] = array();
329 365
  }
366

  
330 367
}
331 368

  
332 369
/**

Formats disponibles : Unified diff