function module_weights_system_module_submit in Util 6.2
Same name and namespace in other branches
- 6.3 module_weights.module \module_weights_system_module_submit()
1 string reference to 'module_weights_system_module_submit'
File
- ./
module_weights.module, line 110 - Allows module weights to be viewed and edited.
Code
function module_weights_system_module_submit($form, &$form_state) {
foreach ($form_state['values'] as $key => $weight) {
// Extra step of optimization, update only weights that changed
// also skip on module names that don't match our record in fetch_module_weights().
if (drupal_substr($key, 0, 2) == 'w_') {
$name = drupal_substr($key, 2);
$module_weight = fetch_module_weights($name);
if ($module_weight !== NULL && $module_weight != $weight) {
$query = "UPDATE {system} SET weight = %d WHERE name LIKE '%s'";
db_query($query, (int) $weight, $name);
}
}
}
}