You are here

protected function LinkManagerBase::getLinkDomain in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/rest/src/LinkManager/LinkManagerBase.php \Drupal\rest\LinkManager\LinkManagerBase::getLinkDomain()

Gets the link domain.

Return value

string The link domain.

2 calls to LinkManagerBase::getLinkDomain()
RelationLinkManager::getRelationUri in core/modules/rest/src/LinkManager/RelationLinkManager.php
Gets the URI that corresponds to a field.
TypeLinkManager::getTypeUri in core/modules/rest/src/LinkManager/TypeLinkManager.php
Gets the URI that corresponds to a bundle.

File

core/modules/rest/src/LinkManager/LinkManagerBase.php, line 50
Contains \Drupal\rest\LinkManager\LinkManagerBase.

Class

LinkManagerBase
Defines an abstract base-class for REST link manager objects.

Namespace

Drupal\rest\LinkManager

Code

protected function getLinkDomain() {
  if (empty($this->linkDomain)) {
    if ($domain = $this->configFactory
      ->get('rest.settings')
      ->get('link_domain')) {
      $this->linkDomain = rtrim($domain, '/');
    }
    else {
      $request = $this->requestStack
        ->getCurrentRequest();
      $this->linkDomain = $request
        ->getSchemeAndHttpHost() . $request
        ->getBasePath();
    }
  }
  return $this->linkDomain;
}