| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Argument handler that ignores the argument. 4 */ 5 class views_handler_argument_null extends views_handler_argument { 6 function option_definition() { 7 $options = parent::option_definition(); 8 $options['must_not_be'] = array('default' => FALSE); 9 return $options; 10 } 11 12 /** 13 * Override options_form() so that only the relevant options 14 * are displayed to the user. 15 */ 16 function options_form(&$form, &$form_state) { 17 parent::options_form($form, $form_state); 18 $form['must_not_be'] = array( 19 '#type' => 'checkbox', 20 '#title' => t('Fail basic validation if any argument is given'), 21 '#default_value' => !empty($this->options['must_not_be']), 22 '#description' => t('By checking this field, you can use this to make sure views with more arguments than necessary fail validation.'), 23 ); 24 25 unset($form['wildcard']); 26 unset($form['wildcard_substitution']); 27 } 28 29 /** 30 * Override default_actions() to remove actions that don't 31 * make sense for a null argument. 32 */ 33 function default_actions($which = NULL) { 34 if ($which) { 35 if (in_array($which, array('ignore', 'not found', 'empty', 'default'))) { 36 return parent::default_actions($which); 37 } 38 return; 39 } 40 $actions = parent::default_actions(); 41 unset($actions['summary asc']); 42 unset($actions['summary desc']); 43 return $actions; 44 } 45 46 function validate_argument_basic($arg) { 47 if (!empty($this->options['must_not_be'])) { 48 return !isset($arg); 49 } 50 51 return parent::validate_argument_basic($arg); 52 } 53 54 /** 55 * Override the behavior of query() to prevent the query 56 * from being changed in any way. 57 */ 58 function query() {} 59 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |