function system_module_build_dependencies

6.x system.admin.inc system_module_build_dependencies($modules, $form_values)

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 drupal-6.x/modules/system/system.admin.inc
Submit callback; handles modules form submission.

File

drupal-6.x/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;
}