public function EntityTranslationController::entityFormSourceChange

Form submission handler for EntityTranslationController::entityFormAlter().

Takes care of the source language change.

File

drupal/core/modules/translation_entity/lib/Drupal/translation_entity/EntityTranslationController.php, line 374
Definition of Drupal\translation_entity\EntityTranslationController.

Class

EntityTranslationController
Base class for entity translation controllers.

Namespace

Drupal\translation_entity

Code

public function entityFormSourceChange($form, &$form_state) {
  $form_controller = translation_entity_form_controller($form_state);
  $entity = $form_controller
    ->getEntity($form_state);
  $source = $form_state['values']['source_langcode']['source'];
  $path = $this
    ->getBasePath($entity) . '/translations/add/' . $source . '/' . $form_controller
    ->getFormLangcode($form_state);
  $form_state['redirect'] = array(
    'path' => $path,
  );
  $languages = language_list();
  drupal_set_message(t('Source language set to: %language', array(
    '%language' => $languages[$source]->name,
  )));
}