public function Entity::getTranslation

cis7 public Entity::getTranslation($property, $langcode = NULL)
cle7 public Entity::getTranslation($property, $langcode = NULL)
elmsmedia7 public Entity::getTranslation($property, $langcode = NULL)
icor7 public Entity::getTranslation($property, $langcode = NULL)
meedjum_blog7 public Entity::getTranslation($property, $langcode = NULL)
mooc7 public Entity::getTranslation($property, $langcode = NULL)

Gets the raw, translated value of a property or field.

Supports retrieving field translations as well as i18n string translations.

Note that this returns raw data values, which might not reflect what has been declared for hook_entity_property_info() as no 'getter callbacks' are invoked or no referenced entities are loaded. For retrieving values reflecting the property info make use of entity metadata wrappers, see entity_metadata_wrapper().

@todo Implement an analogous setTranslation() method for updating.


$property_name: The name of the property to return; e.g., 'title'.

$langcode: (optional) The language code of the language to which the value should be translated. If set to NULL, the default display language is being used.

Return value

The raw, translated property value; or the raw, un-translated value if no translation is available.

1 call to Entity::getTranslation()
Entity::defaultLabel in sites/all/modules/ulmus/entity/includes/
Defines the entity label if the 'entity_class_label' callback is used.


sites/all/modules/ulmus/entity/includes/, line 263
Provides a base class for entities.


A common class for entities.


public function getTranslation($property, $langcode = NULL) {
  $all_info = entity_get_all_property_info($this->entityType);
  // Assign by reference to avoid triggering notices if metadata is missing.
  $property_info = &$all_info[$property];

  if (!empty($property_info['translatable'])) {
    if (!empty($property_info['field'])) {
      return field_get_items($this->entityType, $this, $property, $langcode);
    elseif (!empty($property_info['i18n string'])) {
      $name = $this->entityInfo['module'] . ':' . $this->entityType . ':' . $this->identifier() . ':' . $property;
      return entity_i18n_string($name, $this->$property, $langcode);
  return $this->$property;



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.