You are here

protected function LingotekManagementFormBase::getRow in Lingotek Translation 3.1.x

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

Gets a rows fo rendering based on the passed entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity:

Return value

array A render array.

3 calls to LingotekManagementFormBase::getRow()
LingotekJobManagementContentEntitiesForm::getRow in src/Form/LingotekJobManagementContentEntitiesForm.php
Gets a rows fo rendering based on the passed entity.
LingotekManagementForm::getRows in src/Form/LingotekManagementForm.php
Gets the rows for rendering based on the passed entity list.
LingotekManagementRelatedEntitiesForm::getRow in src/Form/LingotekManagementRelatedEntitiesForm.php
Gets a rows fo rendering based on the passed entity.
2 methods override LingotekManagementFormBase::getRow()
LingotekJobManagementContentEntitiesForm::getRow in src/Form/LingotekJobManagementContentEntitiesForm.php
Gets a rows fo rendering based on the passed entity.
LingotekManagementRelatedEntitiesForm::getRow in src/Form/LingotekManagementRelatedEntitiesForm.php
Gets a rows fo rendering based on the passed entity.

File

src/Form/LingotekManagementFormBase.php, line 524

Class

LingotekManagementFormBase
Form for bulk management of content.

Namespace

Drupal\lingotek\Form

Code

protected function getRow($entity) {
  $row = [];
  $source = $this
    ->getSourceStatus($entity);
  $entityTypeId = $entity
    ->getEntityTypeId();
  $translations = $this
    ->getTranslationsStatuses($entity);
  $profile = $this->lingotekConfiguration
    ->getEntityProfile($entity, TRUE);
  $job_id = $this->translationService
    ->getJobId($entity);
  $entity_type = $this->entityTypeManager
    ->getDefinition($entityTypeId);
  $has_bundles = $entity_type
    ->get('bundle_entity_type') != 'bundle';
  if ($has_bundles) {
    $bundleInfo = $this->entityTypeBundleInfo
      ->getBundleInfo($entityTypeId);
    $row['bundle'] = $bundleInfo[$entity
      ->bundle()]['label'];
  }
  $row += [
    'title' => $entity
      ->hasLinkTemplate('canonical') ? $this->linkGenerator
      ->generate($entity
      ->label(), Url::fromRoute($entity
      ->toUrl()
      ->getRouteName(), [
      $entityTypeId => $entity
        ->id(),
    ])) : $entity
      ->id(),
    'source' => $source,
    'translations' => $translations,
    'profile' => $profile ? $profile
      ->label() : '',
    'job_id' => $job_id ?: '',
  ];
  if (!$this->lingotekConfiguration
    ->isEnabled($entityTypeId, $entity
    ->bundle())) {
    $row['profile'] = 'Not enabled';
  }
  return $row;
}