function tmgmt_ui_ajax_callback_language_select in Translation Management Tool 7
Ajax callback to fetch the supported translator services and rebuild the target / source language dropdowns.
1 string reference to 'tmgmt_ui_ajax_callback_language_select'
- tmgmt_job_form in ui/
includes/ tmgmt_ui.pages.inc - Entity API form the job entity.
File
- ui/
includes/ tmgmt_ui.pages.inc, line 836 - Provides page callbacks and form functions for the Translation Management Tool User Interface module.
Code
function tmgmt_ui_ajax_callback_language_select($form, &$form_state) {
$replace = $form_state['input']['_triggering_element_name'] == 'source_language' ? 'target_language' : 'source_language';
$commands[] = ajax_command_replace('#tmgmt-ui-translator-wrapper', drupal_render($form['translator_wrapper']));
$commands[] = ajax_command_replace('#tmgmt-ui-' . str_replace('_', '-', $replace), drupal_render($form['info'][$replace]));
// Replace value of the label field with ajax on language change.
// @todo This manual overwrite is necessary because somehow an old job entity seems to be used.
$form['info']['label']['#value'] = $form_state['values']['label'];
$commands[] = ajax_command_replace('#tmgmt-ui-label', drupal_render($form['info']['label']));
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}