You are here

function i18n_translation_object in Internationalization 7

Get translation set for object

2 calls to i18n_translation_object()
i18n_menu_i18n_translate_path in i18n_menu/i18n_menu.module
Implements hook_i18n_translate_path()
i18n_translation_set_element in i18n_translation/i18n_translation.module
Build translation fieldset for object

File

i18n_translation/i18n_translation.module, line 216
Internationalization (i18n) module - Entity translations

Code

function i18n_translation_object($type, $object, $create = FALSE) {
  if (($field = i18n_translation_set_info($type, 'field', 'i18n_tsid')) && ($tsid = i18n_object_field($object, $field))) {
    return i18n_translation_set_load($tsid, $type);
  }
  elseif ($create) {
    $set = i18n_translation_set_build($type);
    if ($langcode = i18n_object_langcode($object)) {
      $set
        ->add_item($object, $langcode);
    }
    return $set;
  }
}