You are here

function system_module_build_dependencies in Drupal 6

Same name and namespace in other branches
  1. 5 modules/system/system.module \system_module_build_dependencies()

Generate a list of dependencies for modules that are going to be switched on.

Parameters

$modules: The list of modules to check.

$form_values: Submitted form values used to determine what modules have been enabled.

Return value

An array of dependencies.

1 call to system_module_build_dependencies()
system_modules_submit in modules/system/system.admin.inc
Submit callback; handles modules form submission.

File

modules/system/system.admin.inc, line 991
Admin page callbacks for the system module.

Code

function system_module_build_dependencies($modules, $form_values) {
  static $dependencies;
  if (!isset($dependencies) && isset($form_values)) {
    $dependencies = array();
    foreach ($modules as $name => $module) {

      // If the module is disabled, will be switched on and it has dependencies.
      if (!$module->status && $form_values['status'][$name] && isset($module->info['dependencies'])) {
        foreach ($module->info['dependencies'] as $dependency) {
          if (!$form_values['status'][$dependency] && isset($modules[$dependency])) {
            if (!isset($dependencies[$name])) {
              $dependencies[$name] = array();
            }
            $dependencies[$name][] = $dependency;
          }
        }
      }
    }
  }
  return $dependencies;
}