You are here

protected function EntityTranslationDefaultHandler::updateFormLanguage in Entity Translation 7

Update the current form language based on the submitted value.

3 calls to EntityTranslationDefaultHandler::updateFormLanguage()
EntityTranslationCommentHandler::entityFormLanguageWidgetSubmit in includes/translation.handler.comment.inc
EntityTranslationDefaultHandler::entityFormLanguageWidgetSubmit in includes/translation.handler.inc
EntityTranslationNodeHandler::entityFormLanguageWidgetSubmit in includes/translation.handler.node.inc

File

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

Class

EntityTranslationDefaultHandler
Class implementing the default entity translation behaviours.

Code

protected function updateFormLanguage($form_state) {

  // Update the form language as it might have changed. We exploit the
  // validation phase to be sure to act as early as possible.
  $language_key = $this
    ->getLanguageKey();
  if (isset($form_state['values'][$language_key]) && !$this
    ->isTranslationForm()) {
    $langcode = $form_state['values'][$language_key];
    $this
      ->setActiveLanguage($langcode);
  }
}