'checkbox', '#title' => t('Collapse all fieldsets on the module enabling page'), '#default_value' => variable_get('system_collapse', 1), ); return $form; break; case 'hook registry': return array('form_alter'); break; } } /* * Implementation of hook_util_form_alter */ function system_modules_util_form_alter($form_id, &$form) { if ($form_id == 'system_modules' && variable_get('util_system_collapse', 1) == 1) { $form['#theme'] = 'system_modules_util_system_modules_form'; } } /* * Theme function for admin/build/modules */ function theme_system_modules_util_system_modules_form($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[] = ''. drupal_render($form['name'][$key]) .''; $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, // util.module customization '#collapsed' => TRUE, '#value' => theme('table', $header, $rows, array('class' => 'package')), ); $output .= theme('fieldset', $fieldset); } $output .= drupal_render($form); return $output; }