You are here

function entity_translation_unified_form_def_value in Entity Translation Unified Form 8

Instanciate one value (for default_value)

1 call to entity_translation_unified_form_def_value()
entity_translation_unified_form_build_field in ./entity_translation_unified_form.module
Create a field definition from the existing one. Checks about the fields should have been done before calling this

File

./entity_translation_unified_form.module, line 567

Code

function entity_translation_unified_form_def_value($val, $mono = false) {
  if ($mono) {
    return $val;
  }
  if (!is_array($val)) {
    return $val;
  }
  if (isset($val['date'])) {
    return $val['date'];

    // date only needs date object
  }
  if (count($val) == 1) {
    return current($val);
  }

  // this probably wont work in all cases
  return $val;
}