You are here

function _views_summarize_get_cleaned_value in Views Summarize 1.1.x

Same name and namespace in other branches
  1. 7.2 views_summarize.module \_views_summarize_get_cleaned_value()
  2. 7 views_summarize.module \_views_summarize_get_cleaned_value()

Gets the record's value after stripping invalid characters.

Parameters

type $value: The value from which to strip invalid characters.

type $options: The options element of the variables array that is passed into the summary theme function.

Return value

array The value with invalid characters removed.

4 calls to _views_summarize_get_cleaned_value()
views_summarize_type_average in ./views_summarize.module
Creates the markup for the total value for an average column.
views_summarize_type_average_no_empties in ./views_summarize.module
Creates the markup for the total value for an average column.
views_summarize_type_currency in ./views_summarize.module
Creates the markup for the total value for a currency amount.
views_summarize_type_total in ./views_summarize.module
Creates the markup for the total value for a numeric column.

File

./views_summarize.module, line 417
Defines the functionality and Drupal hooks for this module.

Code

function _views_summarize_get_cleaned_value($value, $options) {
  $value = preg_replace('/[^0-9\\.\\,\\-]/', '', strip_tags($value));
  if (!empty($options['views_field_settings']['thousand_separator'])) {
    $value = str_replace($options['views_field_settings']['thousand_separator'], '', $value);
  }
  if (!empty($options['views_field_settings']['decimal_separator'])) {
    $value = str_replace($options['views_field_settings']['decimal_separator'], '.', $value);
  }
  return $value;
}