function charts_cast_element_integer_values in Charts 7.2
Same name and namespace in other branches
- 8 includes/charts.pages.inc \charts_cast_element_integer_values()
Recursive function to cast integer values.
1 call to charts_cast_element_integer_values()
- charts_pre_render_element in ./
charts.module - Main #pre_render callback to expand a chart element.
File
- ./
charts.module, line 393 - Provides elements for rendering charts and Views integration.
Code
function charts_cast_element_integer_values(&$element) {
// Cast options to integers to avoid redundant library fixing problems.
$integer_options = array(
// Chart options.
'#title_font_size',
'#font_size',
'#legend_title_font_size',
'#legend_font_size',
'#width',
'#height',
// Axis options.
'#title_font_size',
'#labels_font_size',
'#labels_rotation',
'#max',
'#min',
// Data options.
'#decimal_count',
);
foreach ($element as $property_name => $value) {
if (is_array($element[$property_name])) {
charts_cast_element_integer_values($element[$property_name]);
}
elseif ($property_name && in_array($property_name, $integer_options)) {
$element[$property_name] = is_null($element[$property_name]) || strlen($element[$property_name]) === 0 ? NULL : (int) $element[$property_name];
}
}
}