You are here

function i18n_field_entity_property_callback in Internationalization 7

Callback to translate entity property info for a fields.

See also

entity_metadata_field_entity_property_info()

entity_metadata_field_default_property_callback()

i18n_field_i18n_object_info_alter()

hook_module_implements_alter()

2 string references to 'i18n_field_entity_property_callback'
i18n_field_field_info_alter in i18n_field/i18n_field.module
Implements hook_field_info_alter().
i18n_field_i18n_object_info_alter in i18n_field/i18n_field.module
Implements hook_i18n_object_info_alter().

File

i18n_field/i18n_field.module, line 499
Internationalization (i18n) module - Field handling

Code

function i18n_field_entity_property_callback(&$info, $entity_type, $field, $instance, $field_type) {
  global $language;

  // This could create a endless recursion if it's called during rebuilding the
  // cache for i18n_object_info(). So if the cache of i18n_object_info isn't
  // available yet we assume the worst case, leave the info alone but trigger a
  // rebuild of the property when hook_i18n_object_info_alter is invoked. At
  // that point the info is available and we can rely on it.
  if (!($info =& drupal_static('i18n_object_info'))) {
    $i18n_field_entity_property_callback_fallback =& drupal_static(__FUNCTION__);
    $i18n_field_entity_property_callback_fallback = TRUE;
    return;
  }
  i18n_field_prime_caches();
  $name = $field['field_name'];
  $property =& $info[$entity_type]['bundles'][$instance['bundle']]['properties'][$name];
  $property['label'] = i18n_field_translate_property($instance, 'label', $language->language);
}