| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: views_plugin_argument_validate.inc,v 1.2 2009/06/01 23:34:55 merlinofchaos Exp $ 3 /** 4 * @file 5 * Contains the base argument validator plugin. 6 */ 7 8 /** 9 * @defgroup views_argument_validate_plugins Views' argument validate plugins 10 * @{ 11 * 12 * Allow specialized methods of validating arguments. 13 * 14 * @see hook_views_plugins 15 */ 16 17 /** 18 * Base argument validator plugin to provide basic functionality. 19 * 20 * @ingroup views_argument_validate_plugins 21 */ 22 class views_plugin_argument_validate extends views_plugin { 23 var $option_name = 'validate_argument'; 24 25 /** 26 * Initialize this plugin with the view and the argument 27 * it is linked to. 28 */ 29 function init(&$view, &$argument, $id = NULL) { 30 $this->view = &$view; 31 $this->argument = &$argument; 32 $this->id = $id; 33 } 34 35 /** 36 * Determine if the administrator has the privileges to use this 37 * plugin 38 */ 39 function access() { return TRUE; } 40 41 function argument_form(&$form, &$form_state) { 42 } 43 44 /** 45 * If we don't have access to the form but are showing it anyway, ensure that 46 * the form is safe and cannot be changed from user input. 47 */ 48 function check_access(&$form) { 49 if (!$this->access()) { 50 $form[$this->option_name]['#disabled'] = TRUE; 51 $form[$this->option_name]['#value'] = $form[$this->option_name]['#default_value']; 52 $form[$this->option_name]['#description'] .= ' <strong>' . t('Note: you do not have permission to modify this. If you change the validator, this setting will be lost and you will NOT be able to get it back.') . '</strong>'; 53 } 54 } 55 56 /** 57 * Return the validate argument. 58 */ 59 function get_argument() { 60 return isset($this->argument->options[$this->option_name]) ? $this->argument->options[$this->option_name] : ''; 61 } 62 63 function validate_form(&$form, &$form_state) { } 64 65 function validate_argument($arg) { return TRUE; } 66 } 67 68 /** 69 * @} 70 */ 71
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |