2 // $Id: views_plugin_argument_validate.inc,v 1.1 2008/09/03 19:21:30 merlinofchaos Exp $
5 * Contains the base argument validator plugin.
9 * Base argument validator plugin to provide basic functionality.
11 * @ingroup views_argument_validate_plugins
13 class views_plugin_argument_validate extends views_plugin {
14 var $option_name = 'validate_argument';
17 * Initialize this plugin with the view and the argument
20 function init(&$view, &$argument, $id = NULL) {
22 $this->argument = &$argument;
27 * Determine if the administrator has the privileges to use this
30 function access() { return TRUE; }
32 function argument_form(&$form, &$form_state) {
36 * If we don't have access to the form but are showing it anyway, ensure that
37 * the form is safe and cannot be changed from user input.
39 function check_access(&$form) {
40 if (!$this->access()) {
41 $form[$this->option_name]['#disabled'] = TRUE;
42 $form[$this->option_name]['#value'] = $form[$this->option_name]['#default_value'];
43 $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>';
48 * Return the validate argument.
50 function get_argument() {
51 return isset($this->argument->options[$this->option_name]) ? $this->argument->options[$this->option_name] : '';
54 function validate_form(&$form, &$form_state) { }
56 function validate_argument($arg) { return TRUE; }