function charts_trim_array in Charts 8
Same name and namespace in other branches
- 7.2 charts.module \charts_trim_array()
Recursive function to trim out empty options that aren't used.
Parameters
array $array: Array may contain empty options.
4 calls to charts_trim_array()
- _charts_google_populate_chart_data in modules/
charts_google/ charts_google.inc - Utility to populate chart data.
- _charts_google_render in modules/
charts_google/ charts_google.inc - Chart render callback; Convert all chart-level data.
- _charts_highcharts_populate_chart_data in modules/
charts_highcharts/ charts_highcharts.inc - Utility to populate chart data.
- _charts_highcharts_render in modules/
charts_highcharts/ charts_highcharts.inc - Chart render callback; Convert all chart-level data.
File
- includes/
charts.pages.inc, line 163 - Menu callbacks for Charts module.
Code
function charts_trim_array(&$array) {
foreach ($array as $key => &$value) {
if (is_array($value)) {
charts_trim_array($value);
}
elseif (is_null($value) || is_array($value) && count($value) === 0) {
unset($array[$key]);
}
}
}