You are here

public function Domain::disable in Domain Access 8

Disables the configuration entity.

Return value

$this

Overrides ConfigEntityBase::disable

File

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

Class

Domain
Defines the domain entity.

Namespace

Drupal\domain\Entity

Code

public function disable() {
  if (!$this
    ->isDefault()) {
    $this
      ->setStatus(FALSE);
    $this
      ->setHostname($this
      ->getCanonical());
    $this
      ->save();
  }
  else {
    \Drupal::messenger()
      ->addMessage($this
      ->t('The default domain cannot be disabled.'), 'warning');
  }
}