public function ContentEntitySource::getLabel

Return a title for this job item.

Parameters

string|false: The label of 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;
  $label = FALSE;
  if ($entity = static::load($job_item
    ->getItemType(), $job_item
    ->getItemId(), $langcode)) {
    $label = $entity
      ->label() ?: $entity
      ->id();
  }
  return is_bool($label) ? $label : (string) $label;
}