You are here

public function DomainStorage::loadByHostname in Domain Access 8

Loads a domain record by hostname lookup.

Parameters

string $hostname: A hostname string, in the format example.com.

Return value

\Drupal\domain\DomainInterface|null The domain record or NULL.

Overrides DomainStorageInterface::loadByHostname

File

domain/src/DomainStorage.php, line 105

Class

DomainStorage
Loads Domain records.

Namespace

Drupal\domain

Code

public function loadByHostname($hostname) {
  $hostname = $this
    ->prepareHostname($hostname);
  $result = $this
    ->loadByProperties([
    'hostname' => $hostname,
  ]);
  if (empty($result)) {
    return NULL;
  }
  return current($result);
}