function _comment_alter_cleanup_arrays in Comment Alter 8
Same name and namespace in other branches
- 7 comment_alter.module \_comment_alter_cleanup_arrays()
Helper function to recursively clean up semi-empty arrays.
Eg. array('foo' => array('bar' => array('baz' => ''))) becomes array().
Parameters
array $a: Array whose empty elements should be removed.
1 call to _comment_alter_cleanup_arrays()
- _comment_alter_cleanup_field_values in ./
comment_alter.module - Helper function to clean up field values for comparison.
File
- ./
comment_alter.module, line 292 - Allows to alter entities from comment form.
Code
function _comment_alter_cleanup_arrays(&$a) {
if (is_array($a)) {
foreach ($a as $key => &$value) {
if (is_array($value)) {
_comment_alter_cleanup_arrays($value);
}
if (empty($value)) {
unset($a[$key]);
}
}
}
}