function tmgmt_local_tasks_languages in Translation Management Tool 8
Same name and namespace in other branches
- 7 translators/tmgmt_local/tmgmt_local.module \tmgmt_local_tasks_languages()
Gets all involved language pairs for given tasks.
Parameters
array $tasks: Array of tasks ids.
Return value
array Array of involved languages.
2 calls to tmgmt_local_tasks_languages()
- LocalTranslatorTest::testAssigneeSkillsForTasks in translators/
tmgmt_local/ tests/ src/ Functional/ LocalTranslatorTest.php - Test assignee skills.
- tmgmt_local_get_assignees_for_tasks in translators/
tmgmt_local/ tmgmt_local.module - Gets users able to translate all given tasks.
File
- translators/
tmgmt_local/ tmgmt_local.module, line 356 - Main module file for the local translation module.
Code
function tmgmt_local_tasks_languages($tasks) {
$query = \Drupal::database()
->select('tmgmt_local_task', 't');
$query
->condition('tltid', $tasks, 'IN');
$query
->join('tmgmt_job', 'j', 't.tjid = j.tjid');
$result = $query
->fields('j', array(
'source_language',
'target_language',
))
->groupBy('target_language')
->groupBy('source_language')
->execute();
$languages = array();
foreach ($result as $row) {
if (empty($languages[$row->source_language]) || !in_array($row->target_language, $languages[$row->source_language])) {
$languages[$row->source_language][] = $row->target_language;
}
}
return $languages;
}