public function DomainCommands::renameDomain in Domain Access 8
Changes a domain label.
@usage drush domain-name example.com Foo @usage drush domain-name 1 Foo
@command domain:name @aliases domain-name
Parameters
string $domain_id: The machine name or hostname of the domain to relabel.
string $name: The name to use for the domain.
Return value
string The message to print.
Throws
\Drupal\domain\Commands\DomainCommandException
File
- domain/
src/ Commands/ DomainCommands.php, line 745
Class
- DomainCommands
- Drush commands for the domain module.
Namespace
Drupal\domain\CommandsCode
public function renameDomain($domain_id, $name) {
// Resolve the domain.
if ($domain = $this
->getDomainFromArgument($domain_id)) {
$domain
->saveProperty('name', $name);
return dt('Renamed !domain to !name.', [
'!domain' => $domain
->getHostname(),
'!name' => $domain
->label(),
]);
}
return dt('No matching domain record found.');
}