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

sources/tmgmt_config/src/Plugin/tmgmt/Source/ConfigSource.php, line 186

Class

ConfigSource
Content entity source plugin controller.

Namespace

Drupal\tmgmt_config\Plugin\tmgmt\Source

Code

public function getUrl(JobItemInterface $job_item) {
  try {
    $config_mapper = $this
      ->getMapper($job_item);
    return Url::fromRoute($config_mapper
      ->getBaseRouteName(), $config_mapper
      ->getBaseRouteParameters());
  } catch (TMGMTException $e) {
    $this
      ->messenger()
      ->addError(t('Url can not be displayed, the entity does not exist: %error.', array(
      '%error' => $e
        ->getMessage(),
    )));
  }
  return NULL;
}