Created
June 22, 2012 16:40
-
-
Save damiankloip/2973907 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_token_value($token, $values, $view) { | |
$value = NULL; | |
$token_info = $this->get_token_argument($token); | |
$arg = $token_info['arg']; | |
$token_type = $token_info['type']; | |
// Collect all of the values that we intend to use as arguments of our single query. | |
if (isset($view->field[$arg])) { | |
switch ($token_type) { | |
case '%': | |
$value = $view->field[$arg]->last_render; | |
break; | |
case '!': | |
default: | |
$value = $view->field[$arg]->get_value($values); | |
break; | |
} | |
} | |
elseif (isset($view->args[$arg - 1])) { | |
switch ($token_type) { | |
case '%': | |
$keys = array_keys($view->argument); | |
$value = $view->argument[$keys[$arg - 1]]->get_title(); | |
break; | |
case '!': | |
default: | |
$value = $view->args[$arg - 1]; | |
break; | |
} | |
} | |
else { | |
$value = check_plain(trim($token, '\'"')); | |
} | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment