You are here

function feeds_tamper_ui_list_form_validate in Feeds Tamper 6

Same name and namespace in other branches
  1. 7 feeds_tamper_ui/feeds_tamper_ui.admin.inc \feeds_tamper_ui_list_form_validate()

File

feeds_tamper_ui/feeds_tamper_ui.admin.inc, line 116
Forms and their accompanying validation and submit functions for Feeds Tamper UI.

Code

function feeds_tamper_ui_list_form_validate($form, &$form_state) {
  $mappings = element_children($form['mappings']);
  foreach ($mappings as $i) {
    if (empty($form_state['values'][$i]['table'])) {
      continue;
    }
    foreach ($form_state['values'][$i]['table'] as $id => $value) {

      // I'm anal.
      $value['weight'] = (int) $value['weight'];

      // Someone would have to type this in manually, but that's not too far
      // of of a stretch.
      if ($value['weight'] < 0) {
        form_set_error($i . '][table][' . $id . '][weight', t('Weight must be greater than or equal to zero.'));
      }
    }
  }
}