function _features_export_maximize_dependencies in Features 7.2
Same name and namespace in other branches
- 6 features.export.inc \_features_export_maximize_dependencies()
- 7 features.export.inc \_features_export_maximize_dependencies()
Completes a list of dependencies by adding all indirect dependencies as well.
Mathematically this would be called a 'transitive closure'.
This function is recursive, some of its parameters are only meant to be used in recursive calls.
Parameters
string[] $dependencies: Original list of dependencies. Format: $[*] = $module The array keys will be ignored, which means this has the same result for serial or associative arrays.
string $module_name: (obsolete) Name of the module whose dependencies are being processed. This has no effect whatsoever, so it can be safely omitted.
string[] $maximized: (recursive) List of modules that were already processed in previous recursion levels. Omit in non-recursive call.
bool $first: (recursive) TRUE, if this is not a recursive call.
Return value
string[] Complete list of direct and indirect dependencies. Format: $[] = $module
See also
3 calls to _features_export_maximize_dependencies()
- features_admin_form in ./
features.admin.inc - Form builder for 'admin/structure/features'.
- features_get_orphans in ./
features.module - Generate an array of feature dependencies that have been orphaned.
- features_install_modules in ./
features.module - Enables an array of (feature) modules and their dependencies.
File
- ./
features.export.inc, line 257 - Contains functions that export configuration into feature modules.
Code
function _features_export_maximize_dependencies($dependencies, $module_name = '', $maximized = array(), $first = TRUE) {
foreach ($dependencies as $k => $v) {
$parsed_dependency = drupal_parse_dependency($v);
$name = $parsed_dependency['name'];
if (!in_array($name, $maximized)) {
$maximized[] = $name;
$module = features_get_modules($name);
if ($module && !empty($module->info['dependencies'])) {
$maximized = array_merge($maximized, _features_export_maximize_dependencies($module->info['dependencies'], $module_name, $maximized, FALSE));
}
}
}
return array_unique($maximized);
}