1.20.x views_handler_argument.inc | views_handler_argument::get_value() |
Get the value of this argument.
File
- modules/
views/ handlers/ views_handler_argument.inc, line 1080 - @todo.
Class
- views_handler_argument
- Base class for arguments.
Code
function get_value() {
// If we already processed this argument, we're done.
if (isset($this->argument)) {
return $this->argument;
}
// Otherwise, we have to pretend to process ourself to find the value.
$value = NULL;
// Find the position of this argument within the view.
$position = 0;
foreach ($this->view->argument as $id => $argument) {
if ($id == $this->options['id']) {
break;
}
$position++;
}
$arg = isset($this->view->args[$position]) ? $this->view->args[$position] : NULL;
$this->position = $position;
// Clone ourselves so that we don't break things when we're really
// processing the arguments.
$argument = clone $this;
if (!isset($arg) && $argument->has_default_argument()) {
$arg = $argument->get_default_argument();
// remember that this argument was computed, not passed on the URL.
$this->is_default = TRUE;
}
// Set the argument, which will also validate that the argument can be set.
if ($argument->set_argument($arg)) {
$value = $argument->argument;
}
unset($argument);
return $value;
}