1.20.x views_handler_argument.inc views_handler_argument::validate_arg($arg)

Validate that this argument works. By default, all arguments are valid.

File

modules/views/handlers/views_handler_argument.inc, line 999
@todo.

Class

views_handler_argument
Base class for arguments.

Code

function validate_arg($arg) {
  // By using % in URLs, arguments could be validated twice; this eases
  // that pain.
  if (isset($this->argument_validated)) {
    return $this->argument_validated;
  }

  if ($this->is_exception($arg)) {
    return $this->argument_validated = TRUE;
  }

  if ($this->options['validate']['type'] == 'none') {
    return $this->argument_validated = $this->validate_argument_basic($arg);
  }

  $plugin = $this->get_plugin('argument validator');
  if ($plugin) {
    return $this->argument_validated = $plugin->validate_argument($arg);
  }

  // If the plugin isn't found, fall back to the basic validation path:
  return $this->argument_validated = $this->validate_argument_basic($arg);
}