You are here

function hook_domain_validate_alter in Domain Access 7.3

Same name and namespace in other branches
  1. 8 domain/domain.api.php \hook_domain_validate_alter()
  2. 6.2 API.php \hook_domain_validate_alter()
  3. 7.2 domain.api.php \hook_domain_validate_alter()

Alter the validation step of a domain record.

This hook allows modules to change or extend how domain validation happens. Most useful for international domains or other special cases where a site wants to restrict domain creation is some manner.

NOTE: This does not apply to Domain Alias records.

Parameters

&$error_list: The list of current validation errors. Modify this value by reference. If you return an empty array or NULL, the domain is considered valid.

$subdomain: The HTTP_HOST string value being validated, such as one.example.com. Note that this is checked for uniqueness separately. This value is not modifiable.

Return value

No return value. Modify $error_list by reference. Return an empty array or NULL to validate this domain.

See also

domain_valid_domain()

1 function implements hook_domain_validate_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

domain_test_domain_validate_alter in tests/domain_test.domain.inc
Implements hook_domain_validate_alter().
1 invocation of hook_domain_validate_alter()
domain_valid_domain in ./domain.module
Validate the domain against all correctable errors.

File

./domain.api.php, line 780
API documentation file.

Code

function hook_domain_validate_alter(&$error_list, $subdomain) {

  // Only allow TLDs to be .org for our site.
  if (substr($subdomain, -4) != '.org') {
    $error_list[] = t('Only .org domains may be registered.');
  }
}