You are here

function views_plugin_argument_default_url_path::get_argument in Views URL Path Arguments 7

Returns the default argument.

Overrides views_plugin_argument_default::get_argument

File

./views_plugin_argument_default_url_path.inc, line 15
Contains the 'url path alias' default argument plugin.

Class

views_plugin_argument_default_url_path
Default argument plugin to convert a nid to its url path

Code

function get_argument() {

  // By default provide a views default argument of 'all'.
  // If this value is received, the filter will be ignored; i.e, "all values".
  $return = 'all';

  // Grab the last value from the url.
  $arg = arg();
  $arg = array_pop($arg);
  $arg = check_plain($arg);

  // Is it already the nid?
  if (ctype_digit($arg)) {
    $return = $arg;
  }
  elseif ($nid = drupal_lookup_path('source', $arg)) {
    $return = $nid;
  }
  return $return;
}