You are here

function theme_system_modules_uninstall in Drupal 7

Same name and namespace in other branches
  1. 5 modules/system/system.module \theme_system_modules_uninstall()
  2. 6 modules/system/system.admin.inc \theme_system_modules_uninstall()

Returns HTML for a table of currently disabled modules.

Parameters

$variables: An associative array containing:

  • form: A render element representing the form.

Related topics

File

modules/system/system.admin.inc, line 2700
Admin page callbacks for the system module.

Code

function theme_system_modules_uninstall($variables) {
  $form = $variables['form'];

  // No theming for the confirm form.
  if (isset($form['confirm'])) {
    return drupal_render($form);
  }

  // Table headers.
  $header = array(
    t('Uninstall'),
    t('Name'),
    t('Description'),
  );

  // Display table.
  $rows = array();
  foreach (element_children($form['modules']) as $module) {
    if (!empty($form['modules'][$module]['#required_by'])) {
      $disabled_message = format_plural(count($form['modules'][$module]['#required_by']), 'To uninstall @module, the following module must be uninstalled first: @required_modules', 'To uninstall @module, the following modules must be uninstalled first: @required_modules', array(
        '@module' => $form['modules'][$module]['#module_name'],
        '@required_modules' => implode(', ', $form['modules'][$module]['#required_by']),
      ));
      $disabled_message = '<div class="admin-requirements">' . $disabled_message . '</div>';
    }
    else {
      $disabled_message = '';
    }
    $rows[] = array(
      array(
        'data' => drupal_render($form['uninstall'][$module]),
        'align' => 'center',
      ),
      '<strong><label for="' . $form['uninstall'][$module]['#id'] . '">' . drupal_render($form['modules'][$module]['name']) . '</label></strong>',
      array(
        'data' => drupal_render($form['modules'][$module]['description']) . $disabled_message,
        'class' => array(
          'description',
        ),
      ),
    );
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'empty' => t('No modules are available to uninstall.'),
  ));
  $output .= drupal_render_children($form);
  return $output;
}