...
Registrar Methods
The methods below are required available for registrar modules implementing the Blesta\Core\Util\Modules\Registrar
interface.extending the RegistrarModule class.
checkAvailability($domain, $module_row_id = null)
...
Code Block |
---|
|
class MyModule extends ModuleRegistrarModule {
...
public function checkAvailability($domain, $module_row_id = null) {
// Check if the domain is available (this is dependent on the module's API, omitted here)
$domain = $api->checkDomain($domain);
return isset($domain->availability) ? $domain->availability : false;
_id = null)
{
// Check if the domain is available (this is dependent on the module's API, omitted here)
$domain = $api->checkDomain($domain);
return isset($domain->availability) ? $domain->availability : false;
}
...
} |
getServiceDomain($service)
Registrar modules should use the 'domain' key for their domain field, but if they choose something different, this method can be overridden to get the domain from the appropriate service field.
Code Block |
---|
|
class MyModule extends RegistrarModule {
...
public function getServiceDomain($service)
{
if (isset($service->fields)) {
foreach ($service->fields as $service_field) {
if ($service_field->key == 'domain') {
return $service_field->value;
}
}
}
return $this->getServiceName($service);
}
...
} |
getExpirationDate($domain, $format = 'Y-m-d H:i:s', $module_row_id = null)
...
Code Block |
---|
|
class MyModule extends ModuleRegistrarModule {
...
public function getExpirationDate($domain$service, $format = 'Y-m-d H:i:s', $module_row_id)
{
$domain = null) {$this->getServiceDomain($service);
// Get the domain information (this is dependent on the module's API, omitted here)
$domain = $api->getDomain($domain);
return date(strtotime($domain->expirationDate), $format);
}
...
} |
...
Code Block |
---|
|
class MyModule extends ModuleRegistrarModule {
...
public function getTlds($module_row_id = null) {
return [
'.com',
'.net',
'.org'
];
}
...
} |
...