You are here

function module_weights_system_module_validate in Util 6.2

Same name and namespace in other branches
  1. 6.3 module_weights.module \module_weights_system_module_validate()
1 string reference to 'module_weights_system_module_validate'
module_weights_form_alter in ./module_weights.module

File

./module_weights.module, line 96
Allows module weights to be viewed and edited.

Code

function module_weights_system_module_validate($form, &$form_state) {
  $weights = fetch_module_weights();
  foreach ($weights as $name => $weight) {

    // Submitted weights must be numeric.
    $found = $form_state['values']["w_{$name}"];
    if (!is_numeric($found)) {
      form_set_error("weights][w_{$name}", t('The !module module weight must be a number (found "@found").', array(
        '!module' => $name,
        '@found' => $found,
      )));
    }
  }
}