public static function Chart::trimArray in Charts 5.0.x
Same name and namespace in other branches
- 8.4 src/Element/Chart.php \Drupal\charts\Element\Chart::trimArray()
Trims out, recursively, empty options that aren't used.
Parameters
array $array: The array to trim.
4 calls to Chart::trimArray()
- Google::chartsGooglePopulateChartData in modules/
charts_google/ src/ Plugin/ chart/ Library/ Google.php - Utility to populate chart data.
- Google::preRender in modules/
charts_google/ src/ Plugin/ chart/ Library/ Google.php - Pre render.
- Highcharts::populateData in modules/
charts_highcharts/ src/ Plugin/ chart/ Library/ Highcharts.php - Utility to populate data.
- Highcharts::preRender in modules/
charts_highcharts/ src/ Plugin/ chart/ Library/ Highcharts.php - Pre render.
File
- src/
Element/ Chart.php, line 263
Class
- Chart
- Provides a chart render element.
Namespace
Drupal\charts\ElementCode
public static function trimArray(array &$array) {
foreach ($array as $key => &$value) {
if (is_array($value)) {
self::trimArray($value);
}
elseif (is_null($value) || is_array($value) && count($value) === 0) {
unset($array[$key]);
}
}
}