function _views_summarize_get_formatted_summary in Views Summarize 7.2
Same name and namespace in other branches
- 7 views_summarize.module \_views_summarize_get_formatted_summary()
- 1.1.x views_summarize.module \_views_summarize_get_formatted_summary()
Gets the summary's formatted result.
Parameters
string $total: The summary to format.
array $options: The options element of the variables array that is passed into the summary theme function.
Return value
array The format settings in an associative array.
3 calls to _views_summarize_get_formatted_summary()
- theme_views_summarize_type_average in ./
views_summarize.module - Themes the average of the values in the column.
- theme_views_summarize_type_range in ./
views_summarize.module - Themes the minimum and maximum values in the column.
- theme_views_summarize_type_total in ./
views_summarize.module - Themes the total of the values in the column.
File
- ./
views_summarize.module, line 568 - Provides a views display that outputs summaries of the values in a table.
Code
function _views_summarize_get_formatted_summary($total, array $options) {
$format_settings = array(
'precision' => 0,
'decimal_separator' => NULL,
'thousand_separator' => NULL,
);
if (!empty($options['views_style_options']['precision'])) {
$format_settings['precision'] = (int) $options['views_style_options']['precision'];
}
if (!empty($options['views_style_options']['decimal'])) {
$format_settings['decimal_separator'] = $options['views_style_options']['decimal'];
}
if (!empty($options['views_style_options']['thousand'])) {
$format_settings['thousand_separator'] = $options['views_style_options']['thousand'];
}
$summary = '';
if (is_numeric($total)) {
$summary = number_format($total, $format_settings['precision'], $format_settings['decimal_separator'], $format_settings['thousand_separator']);
}
return $summary;
}