You are here

public function DomainStorage::getDefaultScheme in Domain Access 8

Returns the default http/https scheme for the site.

This function helps us account for variable schemes across environments.

Return value

string A string representation of s scheme (http|https).

Overrides DomainStorageInterface::getDefaultScheme

1 call to DomainStorage::getDefaultScheme()
DomainStorage::create in domain/src/DomainStorage.php
Constructs a new entity object, without permanently saving it.

File

domain/src/DomainStorage.php, line 193

Class

DomainStorage
Loads Domain records.

Namespace

Drupal\domain

Code

public function getDefaultScheme() {

  // Use the foundation request if possible.
  $request = \Drupal::request();
  if (!empty($request)) {
    $scheme = $request
      ->getScheme();
  }
  elseif (!empty($_SERVER['https'])) {
    $scheme = 'https';
  }
  else {
    $scheme = 'http';
  }
  return $scheme;
}