function views_handler_field::render_text
Same name in other branches
- 7.x-3.x handlers/views_handler_field.inc \views_handler_field::render_text()
Perform an advanced text render for the item.
This is separated out as some fields may render lists, and this allows each item to be handled individually.
1 call to views_handler_field::render_text()
- views_handler_field::advanced_render in handlers/
views_handler_field.inc - Render a field using advanced settings.
File
-
handlers/
views_handler_field.inc, line 853
Class
- views_handler_field
- Base field handler that has no options and renders an unformatted field.
Code
function render_text($alter) {
$value = $this->last_render;
if (!empty($alter['alter_text']) && $alter['text'] !== '') {
$tokens = $this->get_render_tokens($alter);
$value = $this->render_altered($alter, $tokens);
}
if (!empty($this->options['alter']['trim_whitespace'])) {
$value = trim($value);
}
// Check whether the value is empty and return nothing, so the field isn't rendered.
// First check whether the field should be hidden if the value(hide_alter_empty = TRUE) /the rewrite is empty (hide_alter_empty = FALSE).
// For numeric values you can specify whether "0"/0 should be empty.
if (($this->options['hide_empty'] && empty($value) || $this->options['hide_alter_empty'] && empty($this->original_value)) && ($value !== 0 && $value !== '0' || $this->options['empty_zero'])) {
return '';
}
if (!empty($alter['strip_tags'])) {
$value = strip_tags($value, $alter['preserve_tags']);
}
if (!empty($alter['trim']) && !empty($alter['max_length'])) {
$value = $this->render_trim_text($alter, $value);
}
if (!empty($alter['nl2br'])) {
$value = nl2br($value);
}
if (!empty($alter['make_link']) && !empty($alter['path'])) {
if (!isset($tokens)) {
$tokens = $this->get_render_tokens($alter);
}
$value = $this->render_as_link($alter, $value, $tokens);
}
return $value;
}