public function ContentEntitySource::getPreviewUrl

Returns preview url if preview is supported.

Parameters

\Drupal\tmgmt\JobItemInterface $job_item: Job item.

Return value

\Drupal\Core\Url Url object.

Overrides SourcePreviewInterface::getPreviewUrl

File

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

Class

ContentEntitySource
Content entity source plugin controller.

Namespace

Drupal\tmgmt_content\Plugin\tmgmt\Source

Code

public function getPreviewUrl(JobItemInterface $job_item) {
  if ($job_item
    ->getJob()
    ->isActive() && !($job_item
    ->isAborted() || $job_item
    ->isAccepted())) {
    return new Url('tmgmt_content.job_item_preview', [
      'tmgmt_job_item' => $job_item
        ->id(),
    ], [
      'query' => [
        'key' => \Drupal::service('tmgmt_content.key_access')
          ->getKey($job_item),
      ],
    ]);
  }
  else {
    return NULL;
  }
}