public function LingotekApi::currentPhase in Lingotek Translation 7.3
Same name and namespace in other branches
- 7.7 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::currentPhase()
- 7.2 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::currentPhase()
- 7.4 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::currentPhase()
- 7.5 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::currentPhase()
- 7.6 lib/Drupal/lingotek/LingotekApi.php \LingotekApi::currentPhase()
Gets the phase data for the active phase of the specified translation target.
Parameters
int $translation_target_id: The ID of a translation target on the Lingotek system.
Return value
mixed An object representing data for the current translation phase, or FALSE on error.
File
- lib/
Drupal/ lingotek/ LingotekApi.php, line 398 - Defines Drupal\lingotek\LingotekApi
Class
- LingotekApi
- @file Defines Drupal\lingotek\LingotekApi
Code
public function currentPhase($translation_target_id) {
if ($target = $this
->getTranslationTarget($translation_target_id)) {
if (!empty($target->phases)) {
$current_phase = FALSE;
foreach ($target->phases as $phase) {
if (!$phase->isMarkedComplete) {
$current_phase = $phase;
break;
}
}
// Return either the first uncompleted phase, or the last phase if all phases are complete.
return $current_phase ? $current_phase : end($target->phases);
}
else {
return FALSE;
}
}
else {
return FALSE;
}
}