You are here

public function ContentTranslationPreviewController::title in Translation Management Tool 8

The _title_callback for the page that renders a single node in preview.

Parameters

\Drupal\tmgmt\JobItemInterface $tmgmt_job_item: The current node.

Return value

string The page title.

1 string reference to 'ContentTranslationPreviewController::title'
tmgmt_content.routing.yml in sources/content/tmgmt_content.routing.yml
sources/content/tmgmt_content.routing.yml

File

sources/content/src/Controller/ContentTranslationPreviewController.php, line 91

Class

ContentTranslationPreviewController
Content preview translation controller.

Namespace

Drupal\tmgmt_content\Controller

Code

public function title(JobItemInterface $tmgmt_job_item) {
  $target_language = $tmgmt_job_item
    ->getJob()
    ->getTargetLanguage()
    ->getName();
  $entity = ContentEntitySource::load($tmgmt_job_item
    ->getItemType(), $tmgmt_job_item
    ->getItemId(), $tmgmt_job_item
    ->getJob()
    ->getSourceLangcode());
  $title = $entity
    ->label();
  return t("Preview of @title for @target_language", [
    '@title' => $title,
    '@target_language' => $target_language,
  ]);
}