function module_weights_form_alter in Util 6.2
Same name and namespace in other branches
- 6.3 module_weights.module \module_weights_form_alter()
File
- ./
module_weights.module, line 70 - Allows module weights to be viewed and edited.
Code
function module_weights_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
// The admin modules page.
case 'system_modules':
$weights = fetch_module_weights();
$form['weights'] = array(
'#tree' => TRUE,
);
foreach ($weights as $name => $weight) {
// We add "w_" to the name so as not to upset system module.
$form['description'][$name]['weights']["w_{$name}"] = array(
'#type' => 'textfield',
'#default_value' => $weight,
'#title' => t('Module weight'),
'#size' => 4,
'#prefix' => '<div class="container-inline">',
'#suffix' => '</div>',
);
}
// Do my #submit before system.module's so all the rebuilding
// operations in system_module_submit use the new weights.
array_unshift($form['#submit'], 'module_weights_system_module_submit');
$form['#validate'][] = 'module_weights_system_module_validate';
break;
}
}