function theme_system_modules_theme in Util 6.2
Same name and namespace in other branches
- 6.3 system_module.module \theme_system_modules_theme()
- 6 system_module.module \theme_system_modules_theme()
File
- ./
system_module.module, line 146 - Customize System Modules fieldsets
Code
function theme_system_modules_theme($form) {
global $user;
//needed to enable
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.
$mods = $form['validation_modules']['#value'];
$packages = array();
foreach ($mods as $module) {
if (!isset($module->info['package']) || !$module->info['package']) {
$module->info['package'] = t('Other');
}
$packages[$module->info['package']][$module->name] = $module->info;
$project[$module->info['name']] = $module->info['project'];
}
ksort($packages);
// Display packages.
$output = '';
$collapse_all = variable_get('system_module_collapse_all', 0);
$throttle_available = module_exists('throttle');
$status_error_php = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of PHP'));
$status_error_core = theme('image', 'misc/watchdog-error.png', t('incompatible'), t('Incompatible with this version of Drupal core'));
$incompat_core = '<div class="incompatible">' . t('This version is incompatible with the !core_version version of Drupal core.', array(
'!core_version' => VERSION,
)) . '</div>';
$incompat_php = '<div class="incompatible">' . t('This module requires PHP version @php_required and is incompatible with PHP version !php_version.', array(
'@php_required' => $php_required,
'!php_version' => phpversion(),
)) . '</div>';
foreach ($packages as $package => $modules) {
$rows = array();
$enabled_count = 0;
foreach ($modules as $key => $module) {
if (isset($form['status'][$key]['#default_value']) && $form['status'][$key]['#default_value']) {
$enabled_count++;
}
$row = array();
$description = drupal_render($form['description'][$key]);
if (isset($form['status']['#incompatible_modules_core'][$key])) {
unset($form['status'][$key]);
$status = $status_error_core;
$description .= $incompat_core;
}
elseif (isset($form['status']['#incompatible_modules_php'][$key])) {
unset($form['status'][$key]);
$status = $status_error_php;
$php_required = $form['status']['#incompatible_modules_php'][$key];
if (substr_count($php_required, '.') < 2) {
$php_required .= '.*';
}
$description .= $incompat_php;
}
else {
$status = drupal_render($form['status'][$key]);
}
$row[] = array(
'data' => $status,
'align' => 'center',
);
if ($throttle_available) {
$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' => $description,
'class' => 'description',
);
$rows[] = $row;
}
// Here we influence the fieldset to be collapsed or expanded by default.
if ($collapse_all) {
$collapsed = isset($user->system_module_cfg[$package]) ? FALSE : TRUE;
}
else {
$collapsed = isset($user->system_module_cfg[$package]) ? TRUE : FALSE;
}
// Is there an 'expand' request?
if (isset($_GET['expand'])) {
// Strip the quotes from the name.
$expand = drupal_substr($_GET['expand'], 1, -1);
if ($expand == $package) {
$collapsed = FALSE;
}
}
$fieldset = array(
'#title' => $package . ' [' . $enabled_count . '] of [' . sizeof($modules) . ']',
'#collapsible' => TRUE,
'#collapsed' => $collapsed,
'#attributes' => array(
'id' => 'package_' . _system_modules_make_pkgid($package),
),
'#value' => theme('table', $header, $rows, array(
'class' => 'package',
)),
);
$output .= theme('fieldset', $fieldset);
}
$output .= drupal_render($form);
return $output;
}