protected function LingotekManagementFormBase::getTranslationsStatuses in Lingotek Translation 4.0.x
Same name and namespace in other branches
- 8.2 src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getTranslationsStatuses()
- 3.0.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getTranslationsStatuses()
- 3.1.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getTranslationsStatuses()
- 3.2.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getTranslationsStatuses()
- 3.3.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getTranslationsStatuses()
- 3.4.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getTranslationsStatuses()
- 3.5.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getTranslationsStatuses()
- 3.6.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getTranslationsStatuses()
- 3.7.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getTranslationsStatuses()
- 3.8.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getTranslationsStatuses()
Gets the translation status of an entity in a format ready to display.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.
Return value
array A render array.
1 call to LingotekManagementFormBase::getTranslationsStatuses()
- LingotekManagementFormBase::getRow in src/
Form/ LingotekManagementFormBase.php - Gets a rows fo rendering based on the passed entity.
File
- src/
Form/ LingotekManagementFormBase.php, line 1623
Class
- LingotekManagementFormBase
- Form for bulk management of content.
Namespace
Drupal\lingotek\FormCode
protected function getTranslationsStatuses(ContentEntityInterface &$entity) {
$statuses = $this->translationService
->getTargetStatuses($entity);
/** @var \Drupal\lingotek\LingotekProfileInterface $profile */
$profile = $this->lingotekConfiguration
->getEntityProfile($entity);
array_walk($statuses, function (&$status, $langcode) use ($entity, $profile) {
if ($profile !== NULL && $profile
->hasDisabledTarget($langcode)) {
$status = Lingotek::STATUS_DISABLED;
}
});
$languages = $this->lingotekConfiguration
->getEnabledLanguages();
foreach ($languages as $langcode => $language) {
if ($profile !== NULL && $profile
->hasDisabledTarget($langcode)) {
$statuses[$langcode] = Lingotek::STATUS_DISABLED;
}
}
return [
'data' => [
'#type' => 'lingotek_target_statuses',
'#entity' => $entity,
'#source_langcode' => $entity
->language()
->getId(),
'#statuses' => $statuses,
],
];
}