function drush_domain_machine_name in Domain Access 8
Changes a domain machine_name.
File
- domain/
domain.drush.inc, line 584 - Drush commands for Domain Access.
Code
function drush_domain_machine_name($argument, $machine_name) {
$machine_name = \Drupal::entityTypeManager()
->getStorage('domain')
->createMachineName($machine_name);
// Resolve the domain.
if ($domain = drush_domain_get_from_argument($argument)) {
$results = \Drupal::entityTypeManager()
->getStorage('domain')
->loadByProperties([
'machine_name' => $machine_name,
]);
foreach ($results as $result) {
if ($result
->id() == $machine_name) {
drush_print(dt('The machine_name @machine_name is being used by domain @hostname.', [
'@machine_name' => $machine_name,
'@hostname' => $result
->getHostname(),
]));
return;
}
}
$domain
->saveProperty('id', $machine_name);
}
}