You are here

protected function i18n_field_instance::translate_field in Internationalization 7

Set field translation for object.

Mot often, this is a direct field set, but sometimes fields may have different formats.

Parameters

$object: A clone of the object or array. Field instance.

Overrides i18n_string_object_wrapper::translate_field

File

i18n_field/i18n_field.inc, line 162
Field and field instance object handlers

Class

i18n_field_instance
Field instance object

Code

protected function translate_field(&$object, $i18nstring, $langcode, $options) {
  if ($i18nstring->property == 'default_value') {

    // Render string without applying format
    $object['default_value'][0]['value'] = $i18nstring
      ->format_translation($langcode, array(
      'sanitize' => FALSE,
    ) + $options);
  }
  else {
    parent::translate_field($object, $i18nstring, $langcode, $options);
  }
}