function system_modules_form_submit

7.x system.module system_modules_form_submit($form, $form_state)
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 3220

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.


  $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) {

    // Refetch all of the modules from the modules table.
    fp_rebuild_modules_list();

    // We should clear the cache if we did something.
    fp_clear_cache();

  }


}