You are here

function domain_drush_create in Domain Access 8

Creates a domain record.

Parameters

Drupal\domain\DomainInterface $domain: A domain entity.

2 calls to domain_drush_create()
drush_domain_add in domain/domain.drush.inc
Adds a new domain.
drush_domain_generate_domains in domain/domain.drush.inc
Generates a list of domains for testing.

File

domain/domain.drush.inc, line 363
Drush commands for Domain Access.

Code

function domain_drush_create(DomainInterface $domain) {
  if ($error = domain_drush_check_response($domain)) {
    drush_set_error('hostname', $error);
  }
  else {
    $domain
      ->save();
    if ($domain
      ->getDomainId()) {
      drush_print(dt('Created @name at @domain.', [
        '@name' => $domain
          ->label(),
        '@domain' => $domain
          ->getHostname(),
      ]));
    }
    else {
      drush_print(dt('The request could not be completed.'));
    }
  }
}