function globallink_taxonomy_send_for_translations in GlobalLink Connect for Drupal 7.6
Same name and namespace in other branches
- 7.7 globallink_taxonomy/globallink_taxonomy.inc \globallink_taxonomy_send_for_translations()
- 7.5 globallink_taxonomy/globallink_taxonomy.inc \globallink_taxonomy_send_for_translations()
Sends taxonomies for translation.
Parameters
array $lids: The array of taxonomy LIDs.
string $pd4: The project director details.
string $submission_name: The name of the submission.
string $due_date: When the translation is due.
string $project_code: The project's registered code.
string $source_locale: The locale of the content being translated.
array $target_locale_arr: Array of desired locales to translate into.
array $submission_details: Associative array of details about the submission.
Return value
object GlobalLink object that represents active translation.
1 call to globallink_taxonomy_send_for_translations()
- globallink_taxonomy_dashboard_form_submit in globallink_taxonomy/
globallink_taxonomy_send.inc - Handles taxonomy form submission.
File
- globallink_taxonomy/
globallink_taxonomy.inc, line 26
Code
function globallink_taxonomy_send_for_translations($lids, $pd4, $submission_name, $due_date, $project_code, $source_locale, $target_locale_arr, $submission_details, $submission_priority) {
module_load_include('inc', 'globallink', 'gl_ws/gl_ws_send_translations');
module_load_include('inc', 'globallink', 'globallink');
$submitter = $submission_details['submitter'];
$globallink_arr = array();
$override_localize = variable_get('globallink_override_localize', 0);
$vocabs = taxonomy_get_vocabularies();
foreach ($lids as $lid) {
$rows = globallink_taxonomy_get_sent_rows_by_bid($lid);
$target_arr = $target_locale_arr;
foreach ($rows as $row) {
if (array_search($row->target, $target_locale_arr)) {
unset($target_arr[$row->target]);
}
}
if (empty($target_arr)) {
continue;
}
$term = taxonomy_term_load($lid);
$path = drupal_lookup_path('alias', 'taxonomy/term/' . $lid, globallink_get_drupal_locale_code($source_locale));
if (empty($term->name)) {
continue;
}
$vocab = '';
if (isset($vocabs[$term->vid])) {
$vocab = $vocabs[$term->vid];
}
else {
continue;
}
$entity_version = system_get_info('module', 'entity_translation');
if ($entity_version['version'] == '7.x-1.0-beta5') {
if ($vocab->i18n_mode == I18N_MODE_LOCALIZE) {
if ($override_localize == 1) {
$xml = globallink_get_taxonomy_xml_for_I18N_MODE_ENTITY_TRANSLATE($term, NULL);
}
else {
$xml = globallink_get_taxonomy_xml_for_I18N_MODE_LOCALIZE($term, $path);
}
}
else {
if ($vocab->i18n_mode == I18N_MODE_TRANSLATE) {
$xml = globallink_get_taxonomy_xml_for_I18N_MODE_ENTITY_TRANSLATE($term, NULL);
}
else {
continue;
}
}
}
else {
if ($vocab->i18n_mode == I18N_MODE_LOCALIZE) {
$xml = globallink_get_taxonomy_xml_for_I18N_MODE_LOCALIZE($term, $path);
}
else {
if ($vocab->i18n_mode == I18N_MODE_ENTITY_TRANSLATION) {
$xml = globallink_get_taxonomy_xml_for_I18N_MODE_ENTITY_TRANSLATE($term, NULL);
}
else {
if ($vocab->i18n_mode == I18N_MODE_TRANSLATE) {
$xml = globallink_get_taxonomy_xml_for_I18N_MODE_ENTITY_TRANSLATE($term, NULL);
}
else {
continue;
}
}
}
}
$name = 'Taxonomy_' . $lid . '.xml';
$globallink = new GlobalLink();
$globallink->type = 'taxonomy';
$globallink->metadata = 'taxonomy';
$globallink->sourceLocale = $source_locale;
$globallink->targetLocale = $target_arr;
$globallink->sourceXML = $xml;
$globallink->sourceFileName = $name;
$globallink->submissionName = $submission_name;
$globallink->submissionPriority = $submission_priority;
$globallink->dueDate = $due_date;
$globallink->otherObjectId = $lid;
$globallink->submissionInstructions = $submission_details['instructions'] . "\nSubmitter: " . $submitter;
$globallink_arr[] = $globallink;
}
if (!empty($globallink_arr)) {
globallink_send_documents_for_translation_to_pd($globallink_arr, $pd4, $project_code, $submitter);
}
return $globallink_arr;
}