You are here

function node_import_check_weight in Node import 6

Check if the value is a valid weight (integer between -X and X).

Uses: $field['delta'].

Related topics

1 string reference to 'node_import_check_weight'
node_import_fields in ./node_import.inc
Returns a list of available content fields for given node_import type.

File

./node_import.inc, line 1359
Public API of the Node import module.

Code

function node_import_check_weight(&$value, $field, $options, $preview) {
  $weight = isset($field['delta']) ? $field['delta'] : 10;
  if (is_numeric($value) && intval($value) <= $weight && intval($value) >= -$weight) {
    $value = intval($value);
    return TRUE;
  }
  node_import_input_error(t('Input error: %value is not allowed for %name (not a weight).', array(
    '%value' => $value,
    '%name' => $field['title'],
  )));
  return FALSE;
}