You are here

public function EntityTranslationDefaultHandler::setOriginalLanguage in Entity Translation 7

Overrides EntityTranslationHandlerInterface::setOriginalLanguage

See also

EntityTranslationHandlerInterface::setOriginalLanguage()

3 calls to EntityTranslationDefaultHandler::setOriginalLanguage()
EntityTranslationDefaultHandler::entityFormSubmit in includes/translation.handler.inc
EntityTranslationDefaultHandler::initTranslations in includes/translation.handler.inc
EntityTranslationDefaultHandler::updateTranslations in includes/translation.handler.inc

File

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

Class

EntityTranslationDefaultHandler
Class implementing the default entity translation behaviours.

Code

public function setOriginalLanguage($langcode) {
  $args = func_get_args();
  $translations = $this
    ->getTranslations();
  if (!isset($translations->original) || $translations->original != $langcode) {
    if (isset($translations->original)) {
      $translations->data[$langcode] = $translations->data[$translations->original];
      $translations->data[$langcode]['language'] = $langcode;
      unset($translations->data[$translations->original]);
    }
    $translations->original = $langcode;
    $this
      ->notifyChildren(__FUNCTION__, $args);
  }
}