00001 <?php 00007 class views_handler_argument_null extends views_handler_argument { 00008 function option_definition() { 00009 $options = parent::option_definition(); 00010 $options['must_not_be'] = array('default' => FALSE); 00011 return $options; 00012 } 00013 00018 function options_form(&$form, &$form_state) { 00019 parent::options_form($form, $form_state); 00020 $form['must_not_be'] = array( 00021 '#type' => 'checkbox', 00022 '#title' => t('Fail basic validation if any argument is given'), 00023 '#default_value' => !empty($this->options['must_not_be']), 00024 '#description' => t('By checking this field, you can use this to make sure views with more arguments than necessary fail validation.'), 00025 '#fieldset' => 'more', 00026 ); 00027 00028 unset($form['exception']); 00029 } 00030 00035 function default_actions($which = NULL) { 00036 if ($which) { 00037 if (in_array($which, array('ignore', 'not found', 'empty', 'default'))) { 00038 return parent::default_actions($which); 00039 } 00040 return; 00041 } 00042 $actions = parent::default_actions(); 00043 unset($actions['summary asc']); 00044 unset($actions['summary desc']); 00045 return $actions; 00046 } 00047 00048 function validate_argument_basic($arg) { 00049 if (!empty($this->options['must_not_be'])) { 00050 return !isset($arg); 00051 } 00052 00053 return parent::validate_argument_basic($arg); 00054 } 00055 00060 function query($group_by = FALSE) {} 00061 }