abstract class LinkManagerBase in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/rest/src/LinkManager/LinkManagerBase.php \Drupal\rest\LinkManager\LinkManagerBase
Defines an abstract base-class for REST link manager objects.
Hierarchy
- class \Drupal\rest\LinkManager\LinkManagerBase
Expanded class hierarchy of LinkManagerBase
File
- core/
modules/ rest/ src/ LinkManager/ LinkManagerBase.php, line 13 - Contains \Drupal\rest\LinkManager\LinkManagerBase.
Namespace
Drupal\rest\LinkManagerView source
abstract class LinkManagerBase {
/**
* Link domain used for type links URIs.
*
* @var string
*/
protected $linkDomain;
/**
* Config factory service.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* The request stack.
*
* @var \Symfony\Component\HttpFoundation\RequestStack
*/
protected $requestStack;
/**
* {@inheritdoc}
*/
public function setLinkDomain($domain) {
$this->linkDomain = rtrim($domain, '/');
return $this;
}
/**
* Gets the link domain.
*
* @return string
* The link domain.
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LinkManagerBase:: |
protected | property | Config factory service. | |
LinkManagerBase:: |
protected | property | Link domain used for type links URIs. | |
LinkManagerBase:: |
protected | property | The request stack. | |
LinkManagerBase:: |
protected | function | Gets the link domain. | |
LinkManagerBase:: |
public | function |