public function DomainAliasStorage::loadByHostname in Domain Access 8
Loads a domain alias record by hostname lookup.
This method will return the best match to a request.
Parameters
string $hostname: A hostname string, in the format example.com.
Return value
\Drupal\domain_alias\DomainAliasInterface|null The best match alias record for the provided hostname.
Overrides DomainAliasStorageInterface::loadByHostname
File
- domain_alias/
src/ DomainAliasStorage.php, line 74
Class
- DomainAliasStorage
- Alias loader utility class.
Namespace
Drupal\domain_aliasCode
public function loadByHostname($hostname) {
$patterns = $this
->getPatterns($hostname);
foreach ($patterns as $pattern) {
if ($alias = $this
->loadByPattern($pattern)) {
return $alias;
}
}
return NULL;
}