You are here

function _simplified_modules_expected_final_module_status in Simplified Modules 7

Returns the expected status of each module after the modules page is submitted.

This function takes into account the fact that system_modules_submit() will give the user a confirmation form and force all module dependencies to be enabled after the modules page form is submitted. It therefore predicts what the final status of each module (enabled or disabled) will be after the user has completely gone through the submission process, including any confirmation forms.

Parameters

$submitted_module_status: An array mapping module names to their submitted status (TRUE for enabled, FALSE for disabled) before the system_modules_submit() function will process them.

$module_dependencies: Module dependencies returned by _simplified_modules_module_build_dependencies().

Return value

An array with the same format as $submitted_module_status, representing the expected status of each module after system_modules_submit() has finished processing it.

2 calls to _simplified_modules_expected_final_module_status()
simplified_modules_system_modules_submit in ./simplified_modules.module
Custom submit handler for the system_modules() admin page.
_simplified_modules_set_expected_status in ./simplified_modules.module
Sets the expected status of a module in all relevant arrays.

File

./simplified_modules.module, line 235
Simplifies the modules page by allowing related modules to be grouped under a single checkbox.

Code

function _simplified_modules_expected_final_module_status($submitted_module_status, $module_dependencies) {
  $final_module_status = $submitted_module_status;
  foreach ($submitted_module_status as $module => $status) {

    // Force all dependencies of the enabled modules to be enabled themselves.
    if ($status) {
      foreach (array_keys($module_dependencies[$module]->requires) as $dependency) {
        $final_module_status[$dependency] = TRUE;
      }
    }
  }
  return $final_module_status;
}