function system_modules_uninstall
system_modules_uninstall($form, $form_state = NULL)
Builds a form of currently disabled modules.
Parameters
$form_state['values']: Submitted form values.
Return value
A form array representing the currently disabled modules.
See also
system_modules_uninstall_validate()
system_modules_uninstall_submit()
Related topics
File
- modules/system/system.admin.inc, line 1256
- Admin page callbacks for the system module.
Code
function system_modules_uninstall($form, $form_state = NULL) { // Make sure the install API is available. include_once DRUPAL_ROOT . '/includes/install.inc'; // Display the confirm form if any modules have been submitted. if (!empty($form_state['storage']) && $confirm_form = system_modules_uninstall_confirm_form($form_state['storage'])) { return $confirm_form; } // Get a list of disabled, installed modules. $all_modules = system_rebuild_module_data(); $disabled_modules = array(); foreach ($all_modules as $name => $module) { if (empty($module->status) && $module->schema_version > SCHEMA_UNINSTALLED) { $disabled_modules[$name] = $module; } } // Only build the rest of the form if there are any modules available to // uninstall. if (!empty($disabled_modules)) { $profile = drupal_get_profile(); uasort($disabled_modules, 'system_sort_modules_by_info_name'); $form['uninstall'] = array('#tree' => TRUE); foreach ($disabled_modules as $module) { $module_name = $module->info['name'] ? $module->info['name'] : $module->name; $form['modules'][$module->name]['#module_name'] = $module_name; $form['modules'][$module->name]['name']['#markup'] = $module_name; $form['modules'][$module->name]['description']['#markup'] = t($module->info['description']); $form['uninstall'][$module->name] = array( '#type' => 'checkbox', '#title' => t('Uninstall @module module', array('@module' => $module_name)), '#title_display' => 'invisible', ); // All modules which depend on this one must be uninstalled first, before // we can allow this module to be uninstalled. (The installation profile // is excluded from this list.) foreach (array_keys($module->required_by) as $dependent) { if ($dependent != $profile && drupal_get_installed_schema_version($dependent) != SCHEMA_UNINSTALLED) { $dependent_name = isset($all_modules[$dependent]->info['name']) ? $all_modules[$dependent]->info['name'] : $dependent; $form['modules'][$module->name]['#required_by'][] = $dependent_name; $form['uninstall'][$module->name]['#disabled'] = TRUE; } } } $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Uninstall'), ); $form['#action'] = url('admin/modules/uninstall/confirm'); } else { $form['modules'] = array(); } return $form; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!system!system.admin.inc/function/system_modules_uninstall/7.x