You are here

public function views_handler_argument::validate_arg in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 handlers/views_handler_argument.inc \views_handler_argument::validate_arg()
  2. 6.2 handlers/views_handler_argument.inc \views_handler_argument::validate_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 1051
Definition of views_handler_argument.

Class

views_handler_argument
Base class for arguments.

Code

public 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);
}