You are here

public function DomainLangHandler::getDomainFromUrl in Domain Lang 8

Return domain object from URL.

Return value

\Drupal\domain\DomainInterface Loaded domain object.

Throws

\Drupal\domain_lang\Exception\DomainLangDomainNotFoundException In case if domain not found.

Overrides DomainLangHandlerInterface::getDomainFromUrl

1 call to DomainLangHandler::getDomainFromUrl()
DomainLangHandler::getDomainConfigName in src/DomainLangHandler.php
Get configuration name for this hostname.

File

src/DomainLangHandler.php, line 121

Class

DomainLangHandler
Domain language handling.

Namespace

Drupal\domain_lang

Code

public function getDomainFromUrl() {
  $domain_id = $this->currentRouteMatch
    ->getParameter('domain');
  $domain = $this->entityTypeManager
    ->getStorage('domain')
    ->load($domain_id);
  if ($domain instanceof DomainInterface) {
    return $domain;
  }
  throw new DomainLangDomainNotFoundException();
}