You are here

private function EntityManager::getResourceUrlByRouteName in Acquia Content Hub 8

Returns the route's resource URL.

Parameters

string $route_name: Route name.

array $url_options: Bulk-upload Url query params.

Return value

string returns URL.

2 calls to EntityManager::getResourceUrlByRouteName()
EntityManager::getBulkResourceUrl in src/EntityManager.php
Builds the bulk-upload url to make a single request.
EntityManager::getResourceUrl in src/EntityManager.php
Returns the local Resource URL.

File

src/EntityManager.php, line 467

Class

EntityManager
Provides a service for managing entity actions for Content Hub.

Namespace

Drupal\acquia_contenthub

Code

private function getResourceUrlByRouteName($route_name, array $url_options = []) {
  $url = Url::fromRoute($route_name, $url_options);
  $path = $url
    ->toString();

  // Get the content hub config settings.
  $rewrite_localdomain = $this->config
    ->get('rewrite_domain');
  if (UrlHelper::isExternal($path)) {

    // If for some reason the $path is an external URL, do not further
    // prefix a domain, and do not overwrite the given domain.
    $full_path = $path;
  }
  elseif ($rewrite_localdomain) {
    $full_path = $rewrite_localdomain . $path;
  }
  else {
    $full_path = $this->baseRoot . $path;
  }
  $url = Url::fromUri($full_path);
  return $url
    ->toUriString();
}