function _make_merge_includes_recursively

master make.utilities.inc _make_merge_includes_recursively($info, $makefile, $element = 'includes')

Helper function to merge includes recursively.

1 call to _make_merge_includes_recursively()
_make_parse_info_file in commands/make/make.utilities.inc
Parse makefile recursively.

File

commands/make/make.utilities.inc, line 84
General utility functions for Drush Make.

Code

function _make_merge_includes_recursively($info, $makefile, $element = 'includes') {
  if (!empty($info[$element])) {
    if (is_array($info[$element])) {
      $includes = array();
      foreach ($info[$element] as $key => $include) {
        if (!empty($include)) {
          if (!$include_makefile = _make_get_include_path($include, $makefile)) {
            return make_error('BUILD_ERROR', dt("Cannot determine include file location: !include", array('!include' => $include)));
          }

          if ($element == 'overrides') {
            $info = array_replace_recursive($info, _make_parse_info_file($include_makefile, $element));
          }
          else {
            $info = array_replace_recursive(_make_parse_info_file($include_makefile), $info);
          }
          unset($info[$element][$key]);
          // Move core back to the top of the list, where
          // make_generate_from_makefile() expects it.
          if (!empty($info['projects'])) {
            array_reverse($info['projects']);
          }
        }
      }
    }
  }
  // Ensure $info['projects'] is an associative array, so that we can merge
  // includes properly.
  make_normalize_info($info);

  return $info;
}