function views_handler_argument::get_value

Get the value of this argument.

Return value

string The value.

File

handlers/views_handler_argument.inc, line 1140

Class

views_handler_argument
Base class for arguments.

Code

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