You are here

function lingotek_get_language_override_form_submit in Lingotek Translation 7.6

Same name and namespace in other branches
  1. 7.7 lingotek.module \lingotek_get_language_override_form_submit()
1 string reference to 'lingotek_get_language_override_form_submit'
lingotek_get_language_override_form in ./lingotek.module
Display the Lingotek language-override form field

File

./lingotek.module, line 1149

Code

function lingotek_get_language_override_form_submit($form, $form_state) {

  // Store the current language of the field data, if different from the stated node language.
  if (!empty($form_state['node']->nid)) {
    $source_node = lingotek_get_source_node($form_state['node']);
    $stated_language = Lingotek::convertDrupal2Lingotek($form_state['node']->language);
    $source_lang_metadata_key = 'source_language_' . $stated_language;
    if (!empty($form_state['values']['language_override'])) {
      lingotek_keystore('node', $source_node->nid, $source_lang_metadata_key, $form_state['values']['language_override']);
      lingotek_keystore('node', $source_node->nid, $source_lang_metadata_key, $form_state['values']['language_override']);
    }
    else {
      lingotek_keystore_delete('node', $source_node->nid, $source_lang_metadata_key);
    }
  }
}