You are here

public function TestSource::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

tmgmt_test/src/Plugin/tmgmt/Source/TestSource.php, line 41

Class

TestSource
Test source plugin implementation.

Namespace

Drupal\tmgmt_test\Plugin\tmgmt\Source

Code

public function getLabel(JobItemInterface $job_item) {
  $label = $this->pluginId . ':' . $job_item
    ->getItemType() . ':' . $job_item
    ->getItemId();

  // We need to test if job and job item labels get properly truncated,
  // therefore in case the job item type is "test_with_long_label" we append
  // further text to the existing label.
  if ($job_item
    ->getItemType() == 'test_with_long_label') {
    $label .= 'Some very long and boring label that definitely exceeds hundred and twenty eight characters which is the maximum character count for the job item label.';
  }
  return $label;
}