function views_handler_argument::validate_arg

3.x views_handler_argument.inc views_handler_argument::validate_arg($arg)
2.x views_handler_argument.inc views_handler_argument::validate_arg($arg)

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

2 calls to views_handler_argument::validate_arg()
views_handler_argument::set_argument in handlers/views_handler_argument.inc
Set the input for this argument
views_handler_argument::validate_argument in handlers/views_handler_argument.inc
Called by the menu system to validate an argument.

File

handlers/views_handler_argument.inc, line 629

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_wildcard($arg)) {
    return $this->argument_validated = TRUE;
  }

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

  $plugin = views_get_plugin('argument validator', $this->options['validate_type']);
  if ($plugin) {
    $plugin->init($this->view, $this, $this->options['validate_type']);
    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);
}