You are here

function piwik_stats_format_value in Piwik Statistic Integration 7.2

Helper function for formatting an statistical value according to its type.

Parameters

string $value: The value to format properly.

string $format: How the value should be formatted.

  • 'number': Simple numbers.
  • 'seconds': Number of seconds.
  • 'percent': Percentual value.
2 calls to piwik_stats_format_value()
piwik_stats_field_formatter_view in ./piwik_stats.module
Implements hook_field_formatter_view().
piwik_stats_tab_page in ./piwik_stats.pages.inc
Page callback to show statistical information on local task tabs.

File

./piwik_stats.module, line 150
Integrates piwik statistics as entity fields.

Code

function piwik_stats_format_value($value, $format) {
  switch ($format) {
    case 'number':
      return $value;
    case 'percent':
      return $value . '%';
    case 'seconds':
      return format_interval($value);
  }
}