function views_handler_field::get_render_tokens
3.x views_handler_field.inc | views_handler_field::get_render_tokens($item) |
2.x views_handler_field.inc | views_handler_field::get_render_tokens($item) |
Get the 'render' tokens to use for advanced rendering.
This runs through all of the fields and arguments that are available and gets their values. This will then be used in one giant str_replace().
2 calls to views_handler_field::get_render_tokens()
- views_handler_field::render_text in handlers/
views_handler_field.inc - Perform an advanced text render for the item.
- views_handler_field_math::render in handlers/
views_handler_field_math.inc - Render the field.
File
- handlers/
views_handler_field.inc, line 691
Class
- views_handler_field
- Base field handler that has no options and renders an unformatted field.
Code
function get_render_tokens($item) {
$tokens = array();
if (!empty($this->view->build_info['substitutions'])) {
$tokens = $this->view->build_info['substitutions'];
}
$count = 0;
foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) {
$token = '%' . ++$count;
if (!isset($tokens[$token])) {
$tokens[$token] = '';
}
// Use strip tags as there should never be HTML in the path.
// However, we need to preserve special characters like " that
// were removed by check_plain().
$tokens['!' . $count] = isset($this->view->args[$count - 1]) ? strip_tags(html_entity_decode($this->view->args[$count - 1])) : '';
}
// Now add replacements for our fields.
foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) {
if (isset($handler->last_render)) {
$tokens["[$field]"] = $handler->last_render;
}
else {
$tokens["[$field]"] = '';
}
$this->add_self_tokens($tokens, $item);
// We only use fields up to (and including) this one.
if ($field == $this->options['id']) {
break;
}
}
return $tokens;
}