system_modules_uninstall($form, $form_state = NULL)Builds a form of currently disabled modules.
system_modules_uninstall_validate()
@see system_modules_uninstall_submit()
$form_state['values'] Submitted form values.
A form array representing the currently disabled modules.
modules/system/system.admin.inc, line 1276
<?php
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;
}
// Pull all disabled modules from the system table.
$disabled_modules = db_query("SELECT name, filename, info FROM {system} WHERE type = 'module' AND status = 0 AND schema_version > :schema ORDER BY name", array(':schema' => SCHEMA_UNINSTALLED));
foreach ($disabled_modules as $module) {
// Grab the module info
$info = unserialize($module->info);
// Load the .install file, and check for an uninstall or schema hook.
// If the hook exists, the module can be uninstalled.
module_load_install($module->name);
if (module_hook($module->name, 'uninstall') || module_hook($module->name, 'schema')) {
$form['modules'][$module->name]['name'] = array('#markup' => $info['name'] ? $info['name'] : $module->name);
$form['modules'][$module->name]['description'] = array('#markup' => t($info['description']));
$options[$module->name] = '';
}
}
// Only build the rest of the form if there are any modules available to uninstall.
if (!empty($options)) {
$form['uninstall'] = array(
'#type' => 'checkboxes',
'#options' => $options,
);
$form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions')));
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Uninstall'),
);
$form['#action'] = url('admin/modules/uninstall/confirm');
}
else {
$form['modules'] = array();
}
return $form;
}
?>