public static function Openlayers::removeEmptyElements in Openlayers 7.3
Recursively removes empty values from an array.
Empty means empty($value) AND not 0.
Parameters
array $array: The array to clean.
Return value
array The cleaned array.
1 call to Openlayers::removeEmptyElements()
- Base::getExport in src/
Types/ Base.php - Return an object, CTools Exportable.
File
- src/
Openlayers.php, line 344 - Contains Openlayers.
Class
- Openlayers
- Class Openlayers.
Namespace
Drupal\openlayersCode
public static function removeEmptyElements(array $array) {
foreach ($array as $key => $value) {
if ($value === '' && $value !== 0) {
unset($array[$key]);
}
elseif (is_array($value)) {
$array[$key] = self::removeEmptyElements($value);
}
}
return $array;
}