public function ContentEntitySource::getPreviewUrl in Translation Management Tool 8
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 641
Class
- ContentEntitySource
- Content entity source plugin controller.
Namespace
Drupal\tmgmt_content\Plugin\tmgmt\SourceCode
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;
}
}