array $modules: The array of modules.
Overrides ConfirmFormBase::buildForm
public function buildForm(array $form, array &$form_state, $modules = array()) {
$uninstall = array();
// Construct the hidden form elements and list items.
foreach ($modules as $module => $value) {
$info = drupal_parse_info_file(drupal_get_path('module', $module) . '/' . $module . '.info.yml');
$uninstall[] = $info['name'];
$form['uninstall'][$module] = array(
'#type' => 'hidden',
'#value' => 1,
);
}
$form['#confirmed'] = TRUE;
$form['uninstall']['#tree'] = TRUE;
$form['text'] = array(
'#markup' => '<p>' . t('The following modules will be completely uninstalled from your site, and <em>all data from these modules will be lost</em>!') . '</p>',
);
$form['modules'] = array(
'#theme' => 'item_list',
'#items' => $uninstall,
);
return parent::buildForm($form, $form_state);
}