function _make_generate_array_filter

8.0.x generate.contents.make.inc _make_generate_array_filter($haystack)
7.x generate.contents.make.inc _make_generate_array_filter($haystack)
master generate.contents.make.inc _make_generate_array_filter($haystack)

Helper function to recursively remove empty values from an array (but not '0'!).

2 calls to _make_generate_array_filter()
make_generate_from_makefile in commands/make/generate.contents.make.inc
Write a makefile based on data parsed from a previous makefile.
make_generate_makefile_contents_yaml in commands/make/generate.contents.make.inc
Generate makefile contents in YAML format.

File

commands/make/generate.contents.make.inc, line 206
Functions for the generate makefile command.

Code

function _make_generate_array_filter($haystack) {
  foreach ($haystack as $key => $value) {
    if (is_array($value)) {
      $haystack[$key] = _make_generate_array_filter($haystack[$key]);
    }
    if (empty($value) && $value !== '0') {
      unset($haystack[$key]);
    }
  }
  return $haystack;
}