You are here

function theme_system_modules in Drupal 5

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

Theme call back for the modules form.

File

modules/system/system.module, line 1533
Configuration system that lets administrators modify the workings of the site.

Code

function theme_system_modules($form) {
  if (isset($form['confirm'])) {
    return drupal_render($form);
  }

  // Individual table headers.
  $header = array(
    t('Enabled'),
  );
  if (module_exists('throttle')) {
    $header[] = t('Throttle');
  }
  $header[] = t('Name');
  $header[] = t('Version');
  $header[] = t('Description');

  // Pull package information from module list and start grouping modules.
  $modules = $form['validation_modules']['#value'];
  foreach ($modules as $module) {
    if (!isset($module->info['package']) || !$module->info['package']) {
      $module->info['package'] = t('Other');
    }
    $packages[$module->info['package']][$module->name] = $module->info;
  }
  ksort($packages);

  // Display packages.
  $output = '';
  foreach ($packages as $package => $modules) {
    $rows = array();
    foreach ($modules as $key => $module) {
      $row = array();
      $row[] = array(
        'data' => drupal_render($form['status'][$key]),
        'align' => 'center',
      );
      if (module_exists('throttle')) {
        $row[] = array(
          'data' => drupal_render($form['throttle'][$key]),
          'align' => 'center',
        );
      }
      $row[] = '<strong>' . drupal_render($form['name'][$key]) . '</strong>';
      $row[] = drupal_render($form['version'][$key]);
      $row[] = array(
        'data' => drupal_render($form['description'][$key]),
        'class' => 'description',
      );
      $rows[] = $row;
    }
    $fieldset = array(
      '#title' => t($package),
      '#collapsible' => TRUE,
      '#collapsed' => $package == 'Core - required',
      '#value' => theme('table', $header, $rows, array(
        'class' => 'package',
      )),
    );
    $output .= theme('fieldset', $fieldset);
  }
  $output .= drupal_render($form);
  return $output;
}