function views_handler_area_result::render
Find out the information to render.
Overrides views_handler_area::render
File
-
handlers/
views_handler_area_result.inc, line 96
Class
- views_handler_area_result
- Views area handler to display some configurable result summary.
Code
public function render($empty = FALSE) {
// Must have options and does not work on summaries.
if (!isset($this->options['content']) || $this->view->plugin_name == 'default_summary') {
return;
}
$output = '';
$format = $this->options['content'];
// @todo Maybe use a possible is views empty functionality.
// Not every view has total_rows set, use view->result instead.
$total = isset($this->view->total_rows) ? $this->view->total_rows : count($this->view->result);
// Get the search information.
$items = array(
'start',
'end',
'total',
'name',
'per_page',
'current_page',
'current_record_count',
'page_count',
);
$replacements = array();
foreach ($items as $item) {
$replacements["@{$item}"] = ${$item};
}
// If the format_plural option is selected..
if (!empty($this->options['format_plural']) && $replacements[$this->options['format_plural_count']] != 1) {
$format = $this->options['format_plural_plural'];
}
// If there is an item count or there is content in the empty area.
if (!empty($total) || !empty($this->options['empty'])) {
// Adds the result to the output.
// We don't want to sanitize with filter_xss_admin() here because Views
// administrators are trusted users and should be allowed to insert
// arbitrary markup.
$output .= str_replace(array_keys($replacements), array_values($replacements), $format);
}
return $output;
}