5 * Definition of views_handler_argument_null.
9 * Argument handler that ignores the argument.
11 * @ingroup views_argument_handlers
13 class views_handler_argument_null extends views_handler_argument {
14 function option_definition() {
15 $options = parent::option_definition();
16 $options['must_not_be'] = array('default' => FALSE, 'bool' => TRUE);
21 * Override options_form() so that only the relevant options
22 * are displayed to the user.
24 function options_form(&$form, &$form_state) {
25 parent::options_form($form, $form_state);
26 $form['must_not_be'] = array(
27 '#type' => 'checkbox',
28 '#title' => t('Fail basic validation if any argument is given'),
29 '#default_value' => !empty($this->options['must_not_be']),
30 '#description' => t('By checking this field, you can use this to make sure views with more arguments than necessary fail validation.'),
31 '#fieldset' => 'more',
34 unset($form['exception']);
38 * Override default_actions() to remove actions that don't
39 * make sense for a null argument.
41 function default_actions($which = NULL) {
43 if (in_array($which, array('ignore', 'not found', 'empty', 'default'))) {
44 return parent::default_actions($which);
48 $actions = parent::default_actions();
49 unset($actions['summary asc']);
50 unset($actions['summary desc']);
54 function validate_argument_basic($arg) {
55 if (!empty($this->options['must_not_be'])) {
59 return parent::validate_argument_basic($arg);
63 * Override the behavior of query() to prevent the query
64 * from being changed in any way.
66 function query($group_by = FALSE) {}