function tmgmt_ui_job_checkout_and_redirect in Translation Management Tool 7
Attempts to checkout a number of jobs and prepare the necessary redirects.
Parameters
array $form_state: Form state array, used to set the initial redirect.
array $jobs: Array of jobs to attempt checkout
See also
tmgmt_ui_job_checkout_multiple()
Related topics
4 calls to tmgmt_ui_job_checkout_and_redirect()
- tmgmt_entity_ui_translate_form_submit in sources/
entity/ ui/ tmgmt_entity_ui.pages.inc - Submit callback for the entity translation overview form.
- tmgmt_i18n_string_translate_form_submit in sources/
i18n_string/ tmgmt_i18n_string.module - tmgmt_node_ui_translate_form_submit in sources/
node/ ui/ tmgmt_node_ui.pages.inc - Submit callback for the node translation overview form.
- tmgmt_ui_cart_request_translation_form_submit in ui/
includes/ tmgmt_ui.pages.inc - Custom form submit callback for tmgmt_ui_cart_cart_form().
File
- ui/
tmgmt_ui.module, line 1157 - Common Translation managment UI.
Code
function tmgmt_ui_job_checkout_and_redirect(array &$form_state, array $jobs) {
$redirects = tmgmt_ui_job_checkout_multiple($jobs);
// If necessary, do a redirect.
if ($redirects) {
if (isset($_GET['destination'])) {
// Remove existing destination, as that will prevent us from being
// redirect to the job checkout page. Set the destination as the final
// redirect instead.
tmgmt_ui_redirect_queue_set($redirects, $_GET['destination']);
unset($_GET['destination']);
}
else {
tmgmt_ui_redirect_queue_set($redirects, current_path());
}
$form_state['redirect'] = tmgmt_ui_redirect_queue_dequeue();
// Count of the job messages is one less due to the final redirect.
drupal_set_message(format_plural(count($redirects), t('One job needs to be checked out.'), t('@count jobs need to be checked out.')));
}
}