You are here

public static function FeedImport::processCSVValidate in Feed Import 7.2

Callback for validating processCSV settings

File

./feed_import.inc.php, line 1328
Feed import class for parsing and processing content.

Class

FeedImport
@file Feed import class for parsing and processing content.

Code

public static function processCSVValidate($field, $value, $default = NULL) {
  switch ($field) {
    case 'length':

      // Must be positive integer.
      if ((int) $value != $value || $value < 0) {
        return $default;
      }
      break;
    case 'use_column_names':
      if ($value != 0 && $value != 1) {
        return $default;
      }
      break;
    default:

      // Check delimiters.
      if (drupal_strlen($value) != 1) {
        return $default;
      }
      break;
  }
  return $value;
}