Same name and namespace in other branches
- 8.9.x core/lib/Drupal/Core/TypedData/TranslatableInterface.php \Drupal\Core\TypedData\TranslatableInterface::getTranslation()
- 9 core/lib/Drupal/Core/TypedData/TranslatableInterface.php \Drupal\Core\TypedData\TranslatableInterface::getTranslation()
Gets a translation of the data.
The returned translation has to be of the same type than this typed data object.
Parameters
$langcode: The language code of the translation to get or LanguageInterface::LANGCODE_DEFAULT to get the data in default language.
Return value
static A typed data object for the translated data.
Throws
\InvalidArgumentException If an invalid or non-existing translation language is specified.
3 calls to TranslatableInterface::getTranslation()
- Media::postSave in core/
modules/ media/ src/ Entity/ Media.php - Acts on a saved entity before the insert or update hook is invoked.
- Media::prepareSave in core/
modules/ media/ src/ Entity/ Media.php - Sets the media entity's field values from the source's metadata.
- Node::preSave in core/
modules/ node/ src/ Entity/ Node.php - Acts on an entity before the presave hook is invoked.
File
- core/
lib/ Drupal/ Core/ TypedData/ TranslatableInterface.php, line 78
Class
- TranslatableInterface
- Interface for translatable data.
Namespace
Drupal\Core\TypedDataCode
public function getTranslation($langcode);