function drush_domain_get_from_argument in Domain Access 8
Same name and namespace in other branches
- 7.3 domain.drush.inc \drush_domain_get_from_argument()
Converts a domain string or domain_id to a $domain array.
On failure, throws a drush error.
8 calls to drush_domain_get_from_argument()
- drush_domain_default in domain/
domain.drush.inc - Sets the default domain id.
- drush_domain_delete in domain/
domain.drush.inc - Deletes a domain record.
- drush_domain_disable in domain/
domain.drush.inc - Disables a domain.
- drush_domain_enable in domain/
domain.drush.inc - Enables a domain.
- drush_domain_machine_name in domain/
domain.drush.inc - Changes a domain machine_name.
File
- domain/
domain.drush.inc, line 624 - Drush commands for Domain Access.
Code
function drush_domain_get_from_argument($argument) {
$domain = \Drupal::entityTypeManager()
->getStorage('domain')
->load($argument);
if (!$domain) {
$domain = \Drupal::entityTypeManager()
->getStorage('domain')
->loadByHostname($argument);
}
if (!$domain) {
drush_set_error('domain', dt('Domain record not found.'));
return NULL;
}
return $domain;
}