You are here

protected function LingotekManagementFormBase::getSourceStatus in Lingotek Translation 3.5.x

Same name and namespace in other branches
  1. 8.2 src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getSourceStatus()
  2. 4.0.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getSourceStatus()
  3. 3.0.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getSourceStatus()
  4. 3.1.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getSourceStatus()
  5. 3.2.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getSourceStatus()
  6. 3.3.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getSourceStatus()
  7. 3.4.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getSourceStatus()
  8. 3.6.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getSourceStatus()
  9. 3.7.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getSourceStatus()
  10. 3.8.x src/Form/LingotekManagementFormBase.php \Drupal\lingotek\Form\LingotekManagementFormBase::getSourceStatus()

Gets the source 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::getSourceStatus()
LingotekManagementFormBase::getRow in src/Form/LingotekManagementFormBase.php
Gets a rows fo rendering based on the passed entity.

File

src/Form/LingotekManagementFormBase.php, line 1548

Class

LingotekManagementFormBase
Form for bulk management of content.

Namespace

Drupal\lingotek\Form

Code

protected function getSourceStatus(ContentEntityInterface $entity) {
  $langcode_source = LingotekLocale::convertLingotek2Drupal($this->translationService
    ->getSourceLocale($entity));
  $language = $this->languageManager
    ->getLanguage($langcode_source);
  $source_status = $this->translationService
    ->getSourceStatus($entity);
  $data = [
    'data' => [
      '#type' => 'lingotek_source_status',
      '#entity' => $entity,
      '#language' => $language,
      '#status' => $source_status,
    ],
  ];
  if ($source_status == Lingotek::STATUS_EDITED && !$this->translationService
    ->getDocumentId($entity)) {
    $data['data']['#context']['status'] = strtolower(Lingotek::STATUS_REQUEST);
  }
  return $data;
}