function system_modules_form_submit

6.x system.module system_modules_form_submit($form, $form_state)
4.x system.module system_modules_form_submit($form, $form_state)
5.x system.module system_modules_form_submit($form, $form_state)

Submit handler for the modules form.

File

modules/system/system.module, line 2056

Code

function system_modules_form_submit($form, $form_state) {

  // Go through all of the checkboxes which we have "module_details" for.  If there is NOT a corresponding
  // checkbox, it means it wasn't checked, and should be disabled in the database.  Otherwise, it means it WAS
  // checked, and should be enabled/installed.
  //fpm($form_state["values"]);

  $did_something = FALSE;

  foreach ($form_state ["values"] as $key => $value) {
    if (strstr($key, "module_details__")) {
      if ($module_details = unserialize(urldecode($value))) {

        $module = $module_details ["module"];

        // Disabling a module.
        if ($module_details ["enabled"] == "1" && !isset($form_state ["values"]["cb__$module"])) {
          // So it WAS enabled, but now the checkbox wasn't checked.  So disable it!
          system_disable_module($module_details);
          $did_something = TRUE;
        }

        // Enabling a module
        if ($module_details ["enabled"] != "1" && isset($form_state ["values"]["cb__$module"])) {
          system_enable_module($module_details);
          $did_something = TRUE;
        }

      }
    }
  }

  if ($did_something) {
    // We should clear the cache if we did something.

    // Refetch all of the modules from the modules table.
    fp_rebuild_modules_list();
    // Rebuild the menu router now.
    menu_rebuild_cache();
  }


}