function tmgmt_entity_ui_translate_form_submit in Translation Management Tool 7
Submit callback for the entity translation overview form.
1 string reference to 'tmgmt_entity_ui_translate_form_submit'
- tmgmt_entity_ui_translate_form in sources/
entity/ ui/ tmgmt_entity_ui.pages.inc - Entity translation overview form.
File
- sources/
entity/ ui/ tmgmt_entity_ui.pages.inc, line 111 - Provides page and form callbacks for the Translation Management Tool Entity Source User Interface module.
Code
function tmgmt_entity_ui_translate_form_submit($form, &$form_state) {
$entity = $form_state['entity'];
$entity_type = $form_state['entity_type'];
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
$values = $form_state['values'];
$jobs = array();
foreach (array_keys(array_filter($values['languages'])) as $langcode) {
// Create the job object.
$job = tmgmt_job_create(entity_language($entity_type, $entity), $langcode, $GLOBALS['user']->uid);
try {
// Add the job item.
$job
->addItem('entity', $entity_type, $id);
// Append this job to the array of created jobs so we can redirect the user
// to a multistep checkout form if necessary.
$jobs[$job->tjid] = $job;
} catch (TMGMTException $e) {
watchdog_exception('tmgmt', $e);
$languages = language_list();
$target_lang_name = $languages[$langcode]->language;
drupal_set_message(t('Unable to add job item for target language %name. Make sure the source content is not empty.', array(
'%name' => $target_lang_name,
)), 'error');
}
}
tmgmt_ui_job_checkout_and_redirect($form_state, $jobs);
}