You are here

function feeds_tamper_convert_case_callback in Feeds Tamper 7

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

File

plugins/convert_case.inc, line 32

Code

function feeds_tamper_convert_case_callback($result, $item_key, $element_key, &$field, $settings, $source) {
  if ($settings['mode'] === 'ucfirst') {
    $field = mb_strtoupper(mb_substr($field, 0, 1, 'UTF-8'), 'UTF-8') . mb_strtolower(mb_substr($field, 1, mb_strlen($field, 'UTF-8'), 'UTF-8'));
  }
  else {
    $field = mb_convert_case($field, $settings['mode'], 'UTF-8');
  }
}