public function Domain::saveProperty in Domain Access 8
Saves a specific domain attribute.
Parameters
string $name: The property key to save for the $domain object.
mixed $value: The value to set for the property.
Overrides DomainInterface::saveProperty
File
- domain/
src/ Entity/ Domain.php, line 256
Class
- Domain
- Defines the domain entity.
Namespace
Drupal\domain\EntityCode
public function saveProperty($name, $value) {
if (isset($this->{$name})) {
$this->{$name} = $value;
$this
->setHostname($this
->getCanonical());
$this
->save();
\Drupal::messenger()
->addMessage($this
->t('The @key attribute was set to @value for domain @hostname.', [
'@key' => $name,
'@value' => $value,
'@hostname' => $this->hostname,
]));
}
else {
\Drupal::messenger()
->addMessage($this
->t('The @key attribute does not exist.', [
'@key' => $name,
]));
}
}