You are here

public function ContentEntitySource::getLabel in Translation Management Tool 8

Return a title for this job item.

Parameters

\Drupal\tmgmt\JobItemInterface $job_item: The job item entity.

Overrides SourcePluginBase::getLabel

File

sources/content/src/Plugin/tmgmt/Source/ContentEntitySource.php, line 128

Class

ContentEntitySource
Content entity source plugin controller.

Namespace

Drupal\tmgmt_content\Plugin\tmgmt\Source

Code

public function getLabel(JobItemInterface $job_item) {

  // Use the source language to a get label for the job item.
  $langcode = $job_item
    ->getJob() ? $job_item
    ->getJob()
    ->getSourceLangcode() : NULL;
  if ($entity = static::load($job_item
    ->getItemType(), $job_item
    ->getItemId(), $langcode)) {
    return $entity
      ->label() ?: $entity
      ->id();
  }
}