'; $form['module_filter']['#suffix'] = ''; $output = drupal_render($form['module_filter']); $form['#theme'] = 'system_modules'; $output .= theme('system_modules', $form); } return $output; } /** * Theme callback for the modules form. * * @param $form * An associative array containing the structure of the form. * * @return * An output string. */ function theme_module_filter_system_modules_tabs($form) { if (isset($form['confirm'])) { return drupal_render($form); } // Individual table headers. $header = array(); $header[] = array('data' => t('Enabled'), 'class' => 'checkbox'); if (module_exists('throttle')) { $header[] = array('data' => t('Throttle'), 'class' => 'checkbox'); } $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. $tab_counts = array(t('All') => array('id' => 'all', 'enabled' => 0, 'total' => 0)); $rows = array(); foreach ($packages as $package => $modules) { $id = strtolower($package); // $id = preg_replace('/[^a-z ]\//', '', $id); $id = preg_replace('/([^a-z])([\/( )])*/', '-', $id); if (!isset($tab_counts[$package])) { $tab_counts[$package] = array('id' => $id, 'enabled' => 0, 'total' => 0); } foreach ($modules as $key => $module) { $tab_counts[t('All')]['total']++; $tab_counts[$package]['total']++; if ($form['status'][$key]['#default_value']) { $tab_counts[$package]['enabled']++; $tab_counts[t('All')]['enabled']++; } $row = array(); $description = drupal_render($form['description'][$key]); if (isset($form['status']['#incompatible_modules_core'][$key])) { unset($form['status'][$key]); $status = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of Drupal core')); $description .= '
'. t('This version is incompatible with the !core_version version of Drupal core.', array('!core_version' => VERSION)) .'
'; } elseif (isset($form['status']['#incompatible_modules_php'][$key])) { unset($form['status'][$key]); $status = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of PHP')); $php_required = $form['status']['#incompatible_modules_php'][$key]; if (substr_count($php_required, '.') < 2) { $php_required .= '.*'; } $description .= '
'. t('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array('@php_required' => $php_required, '!php_version' => phpversion())) .'
'; } else { $status = drupal_render($form['status'][$key]); } $row[] = array('data' => $status, 'class' => 'checkbox'); if (module_exists('throttle')) { $row[] = array('data' => drupal_render($form['throttle'][$key]), 'class' => 'checkbox'); } // Add labels only when there is also a checkbox. if (isset($form['status'][$key])) { $row[] = ''; } else { $row[] = ''. drupal_render($form['name'][$key]) .''; } $row[] = array('data' => drupal_render($form['version'][$key]), 'class' => 'version'); $row[] = array('data' => $description, 'class' => 'description'); // Set the key for the row to the module name so we can easily sort it. // Append the $key variable to the end of the row key to ensure a unique // key. http://drupal.org/node/840324 $rows[$form['name'][$key]['#value'] . $key] = array( 'data' => $row, 'class' => $id .'-tab-content' ); } } $tabs = array(); foreach ($tab_counts as $package => $value) { $count = (variable_get('module_filter_count_enabled', 1)) ? ''. t('!enabled of !total', array('!enabled' => $value['enabled'], '!total' => $value['total'])) .'' : ''; $tabs[$package] = ''. $package . $count .''; } ksort($rows); $output = '
'; $output .= '
'; $output .= '
    '. implode($tabs) .'
'; $output .= '
'. drupal_render($form['buttons']) .'
'; $output .= '
'. drupal_render($form['module_filter']); $output .= theme('table', $header, $rows, array('id' => 'projects')) .'
'; $output .= '
'; $output .= '
'; $output .= drupal_render($form); return $output; }