You are here

function sms_valid_sms_validate_number in SMS Framework 7

Implements hook_sms_validate_number().

Provides validation based on the configured rulesets.

Parameters

string $number: Phone number string.

array $options: Array of options.

Return value

string|null NULL if validation succeeded. Error message if failed.

File

modules/sms_valid/sms_valid.module, line 24
Number validation feature module for Drupal SMS Framework.

Code

function sms_valid_sms_validate_number($number, $options) {
  if (variable_get('sms_valid_use_rulesets', FALSE) || array_key_exists('test', $options)) {
    $result = sms_valid_validate($number, $options);
    if ($result['pass'] === false || !empty($result['errors'])) {
      return $result['errors'];
    }
    else {
      return array();
    }
  }
  return array();
}