function lingotek_get_change_workflow_form_submit in Lingotek Translation 7.5
Same name and namespace in other branches
- 7.7 lingotek.module \lingotek_get_change_workflow_form_submit()
- 7.4 lingotek.module \lingotek_get_change_workflow_form_submit()
- 7.6 lingotek.module \lingotek_get_change_workflow_form_submit()
1 string reference to 'lingotek_get_change_workflow_form_submit'
File
- ./
lingotek.module, line 1081
Code
function lingotek_get_change_workflow_form_submit($form, $form_state) {
if (isset($form_state['nids']) && !empty($form_state['nids'])) {
$nids = $form_state['nids'];
$workflow_id = $form_state['values']['lingotek']['workflow_id'];
if (isset($form_state['values']['lingotek']['prefill_phases_checkbox']) && $form_state['values']['lingotek']['prefill_phases_checkbox']) {
$prefill_phase = $form_state['values']['lingotek']['prefill_phase_select'];
}
else {
$prefill_phase = NULL;
}
// SUBMIT THE WORKFLOW CHANGES TO TMS
$entity_type = $form_state['entity_type'];
$document_ids = LingotekSync::getDocIdsFromEntityIds($entity_type, $nids);
if (!$document_ids) {
return;
}
$api = LingotekApi::instance();
$api
->changeWorkflow($document_ids, $workflow_id, $prefill_phase);
// CREATE/UPDATE WORKFLOW ENTRIES IN THE LINGOTEK METADATA TABLE
foreach ($nids as $nid) {
lingotek_keystore($entity_type, $nid, 'workflow_id', $workflow_id);
LingotekSync::setAllTargetStatus($entity_type, $nid, LingotekSync::STATUS_PENDING);
}
}
}