You are here

function feeds_tamper_convert_boolean_callback in Feeds Tamper 7

Same name and namespace in other branches
  1. 6 plugins/convert_boolean.inc \feeds_tamper_convert_boolean_callback()
1 string reference to 'feeds_tamper_convert_boolean_callback'
convert_boolean.inc in plugins/convert_boolean.inc

File

plugins/convert_boolean.inc, line 75

Code

function feeds_tamper_convert_boolean_callback($result, $item_key, $element_key, &$field, $settings, $source) {

  // Copy field value in case 'pass' is set.
  $match_field = $field;
  if (!$settings['match_case']) {
    $match_field = drupal_strtolower($match_field);
  }
  if ($match_field == $settings['true_value']) {
    $field = 1;
    return;
  }
  if ($match_field == $settings['false_value']) {
    $field = 0;
    return;
  }
  if ($settings['no_match'] == 'pass') {
    return;
  }
  $field = $settings['no_match_value'];
}