public function TestSource::getUrl

Returns the Uri for this job item.

Parameters

\Drupal\tmgmt\JobItemInterface $job_item: The job item entity.

Return value

\Drupal\Core\Url|null The URL object for the source object.

Overrides SourcePluginBase::getUrl

File

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

Class

TestSource
Test source plugin implementation.

Namespace

Drupal\tmgmt_test\Plugin\tmgmt\Source

Code

public function getUrl(JobItemInterface $job_item) {

  // Provide logic which allows to test for source which is either accessible
  // or not accessible to anonymous user. This is may then be used to test if
  // the source url is attached to the job comment sent to a translation
  // service.
  if ($job_item
    ->getItemType() == 'test_not_accessible') {
    return Url::fromRoute('system.admin');
  }
  else {
    return Url::fromRoute('<front>');
  }
}