You are here

function feeds_tamper_convert_boolean_callback in Feeds Tamper 6

Same name and namespace in other branches
  1. 7 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 70

Code

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

  // 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'];
}