You are here

public function EntityInterface::getTranslation in Entity API 7

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.

Parameters

$property: 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

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

1 method overrides EntityInterface::getTranslation()
Entity::getTranslation in includes/entity.inc
Gets the raw, translated value of a property or field.

File

includes/entity.inc, line 157
Provides a base class for entities.

Class

EntityInterface
Interface for class based entities.

Code

public function getTranslation($property, $langcode = NULL);