function _make_generate_array_filter_key

8.0.x generate.contents.make.inc _make_generate_array_filter_key($needle, $haystack)
master generate.contents.make.inc _make_generate_array_filter_key($needle, $haystack)

Helper function to recursively remove elements matching a specific key from an array.

1 call to _make_generate_array_filter_key()
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 221
Functions for the generate makefile command.

Code

function _make_generate_array_filter_key($needle, $haystack) {
  foreach ($haystack as $key => $value) {
    if ($key === $needle) {
      unset($haystack[$key]);
    }
    elseif (is_array($value)) {
      $haystack[$key] = _make_generate_array_filter_key($needle, $haystack[$key]);
    }
  }
  return $haystack;
}