You are here

public function EntityTranslationDefaultHandler::updateTranslations in Entity Translation 7

Overrides EntityTranslationHandlerInterface::updateTranslations

See also

EntityTranslationHandlerInterface::updateTranslations()

File

includes/translation.handler.inc, line 776
Default translation handler for the translation module.

Class

EntityTranslationDefaultHandler
Class implementing the default entity translation behaviours.

Code

public function updateTranslations() {
  $langcode = $this
    ->getLanguage();

  // Only create a translation on edit if the translation set is empty:
  // the entity might have been created with language set to "language
  // neutral".
  if (empty($this
    ->getTranslations()->data)) {
    $this
      ->initTranslations();
  }
  elseif (!empty($langcode)) {
    $this
      ->setOriginalLanguage($langcode);
  }
}