You are here

public function Domain::isActive in Domain Access 8

Detects if the current domain is the active domain.

Return value

bool TRUE if domain enabled, FALSE otherwise.

Overrides DomainInterface::isActive

File

domain/src/Entity/Domain.php, line 175

Class

Domain
Defines the domain entity.

Namespace

Drupal\domain\Entity

Code

public function isActive() {
  $negotiator = \Drupal::service('domain.negotiator');

  /** @var self $domain */
  $domain = $negotiator
    ->getActiveDomain();
  if (empty($domain)) {
    return FALSE;
  }
  return $this
    ->id() == $domain
    ->id();
}