You are here

function _views_calc_format in Views Calc 5

1 call to _views_calc_format()
views_calc_field_handler in ./views_calc.module
The field handler. Used to format the calculation results

File

./views_calc.module, line 451
This module will allow you to add calculated fields to views tables and compute (SUM, COUNT, AVG, etc) columns of numeric data in a views table.

Code

function _views_calc_format($value, $format, $custom) {
  $formats = _views_calc_format_options();
  $format = $formats[$format];
  $tmp = explode(':', $format);
  $function = trim($tmp[0]);
  $vars = $tmp[1];
  if ($function == 'custom') {
    $tmp = explode(':', $custom);
    $function = trim($tmp[0]);
    $vars = $tmp[1];
  }
  if (empty($function) || $function == 'none') {
    $function = 'check_plain';
  }
  return $function($value, $vars);
}