function drush_domain_add_validate in Domain Access 8
Same name and namespace in other branches
- 7.3 domain.drush.inc \drush_domain_add_validate()
Validates the domain add command arguments.
Parameters
string $hostname: The domain name to register.
string $name: The name to use for this domain.
Return value
bool TRUE when validation passed, FALSE otherwise.
File
- domain/
domain.drush.inc, line 346 - Drush commands for Domain Access.
Code
function drush_domain_add_validate($hostname, $name) {
$errors = domain_drush_validate_domain($hostname);
if (!empty($errors)) {
return drush_set_error('domain', $errors);
}
elseif (\Drupal::entityTypeManager()
->getStorage('domain')
->loadByHostname($hostname)) {
return drush_set_error('domain', dt('The hostname is already registered.'));
}
return TRUE;
}