source: sipes/modules_contrib/views/handlers/views_handler_argument_null.inc @ 65dadeb

stableversion-3.0
Last change on this file since 65dadeb was 59029b2, checked in by José Gregorio Puentes <jpuentes@…>, 8 años ago

se actualizo la version del modulo views

  • Propiedad mode establecida a 100644
File size: 1.7 KB
Línea 
1<?php
2/**
3 * Argument handler that ignores the argument.
4 *
5 * @ingroup views_argument_handlers
6 */
7class views_handler_argument_null extends views_handler_argument {
8  function option_definition() {
9    $options = parent::option_definition();
10    $options['must_not_be'] = array('default' => FALSE);
11    return $options;
12  }
13
14  /**
15   * Override options_form() so that only the relevant options
16   * are displayed to the user.
17   */
18  function options_form(&$form, &$form_state) {
19    parent::options_form($form, $form_state);
20    $form['must_not_be'] = array(
21      '#type' => 'checkbox',
22      '#title' => t('Fail basic validation if any argument is given'),
23      '#default_value' => !empty($this->options['must_not_be']),
24      '#description' => t('By checking this field, you can use this to make sure views with more arguments than necessary fail validation.'),
25    );
26
27    unset($form['wildcard']);
28    unset($form['wildcard_substitution']);
29  }
30
31  /**
32   * Override default_actions() to remove actions that don't
33   * make sense for a null argument.
34   */
35  function default_actions($which = NULL) {
36    if ($which) {
37      if (in_array($which, array('ignore', 'not found', 'empty', 'default'))) {
38        return parent::default_actions($which);
39      }
40      return;
41    }
42    $actions = parent::default_actions();
43    unset($actions['summary asc']);
44    unset($actions['summary desc']);
45    return $actions;
46  }
47
48  function validate_argument_basic($arg) {
49    if (!empty($this->options['must_not_be'])) {
50      return !isset($arg);
51    }
52
53    return parent::validate_argument_basic($arg);
54  }
55
56  /**
57   * Override the behavior of query() to prevent the query
58   * from being changed in any way.
59   */
60  function query() {}
61}
Nota: Vea TracBrowser para ayuda de uso del navegador del repositorio.