public function LingotekCliService::checkTranslationsStatuses in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8.2 src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::checkTranslationsStatuses()
- 4.0.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::checkTranslationsStatuses()
- 3.0.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::checkTranslationsStatuses()
- 3.1.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::checkTranslationsStatuses()
- 3.3.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::checkTranslationsStatuses()
- 3.4.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::checkTranslationsStatuses()
- 3.5.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::checkTranslationsStatuses()
- 3.6.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::checkTranslationsStatuses()
- 3.7.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::checkTranslationsStatuses()
- 3.8.x src/Cli/LingotekCliService.php \Drupal\lingotek\Cli\LingotekCliService::checkTranslationsStatuses()
File
- src/
Cli/ LingotekCliService.php, line 136
Class
Namespace
Drupal\lingotek\CliCode
public function checkTranslationsStatuses($entity_type_id, $entity_id, $langcodes = [
'all',
]) {
$entity = $this
->getEntity($entity_type_id, $entity_id);
if ($entity instanceof EntityInterface) {
$this->translationService
->checkTargetStatuses($entity);
$languages = $this->translationService
->getTargetStatuses($entity);
unset($languages[$entity
->getUntranslated()
->language()
->getId()]);
$result = [];
foreach ($languages as $langcode => $status) {
if (!in_array('all', $langcodes)) {
if (!in_array($langcode, $langcodes)) {
continue;
}
}
$result[$langcode] = [
'langcode' => $langcode,
'status' => $status,
];
}
return $result;
}
// Contains an error message.
return $entity;
}