You are here

function node_import_check_values in Node import 6

Check if the value is in the list of allowed values (by key or value).

Uses: $field['allowed_values'].

Related topics

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

File

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

Code

function node_import_check_values(&$value, $field, $options, $preview) {
  foreach ($field['allowed_values'] as $key => $title) {
    $tmp = drupal_strtolower($value);
    if ($tmp === drupal_strtolower($key) || $tmp === drupal_strtolower($title)) {
      $value = (string) $key;
      return TRUE;
    }
  }
  node_import_input_error(t('Input error: %value is not allowed for %name (not in allowed values list).', array(
    '%value' => $value,
    '%name' => $field['title'],
  )));
  return FALSE;
}