You are here

class MobileNumberConstraint in Mobile Number 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Validation/Constraint/MobileNumberConstraint.php \Drupal\mobile_number\Plugin\Validation\Constraint\MobileNumberConstraint

Validates Mobile number fields. Includes validation for:

  • Number validity
  • Allowed country
  • Verification flood
  • Mobile number verification
  • Uniqueness.

Plugin annotation


@Constraint(
  id = "MobileNumber",
  label = @Translation("Mobile number constraint", context = "Validation"),
)

Hierarchy

  • class \Drupal\mobile_number\Plugin\Validation\Constraint\MobileNumberConstraint extends \Symfony\Component\Validator\Constraint

Expanded class hierarchy of MobileNumberConstraint

File

src/Plugin/Validation/Constraint/MobileNumberConstraint.php, line 20

Namespace

Drupal\mobile_number\Plugin\Validation\Constraint
View source
class MobileNumberConstraint extends Constraint {
  public $verifyRequired = 'The @field_name @value must be verified.';
  public $unique = 'A @entity_type with @field_name @value already exists.';
  public $validity = 'The @field_name @value is invalid for the following reason: @message.';
  public $flood = 'Too many verification attempts for @field_name @value, please try again in a few hours.';
  public $verification = 'Invalid verification code for @field_name @value.';
  public $allowedCountry = 'The country @value provided for @field_name is not an allowed country.';

  /**
   * {@inheritdoc}
   */
  public function validatedBy() {
    return '\\Drupal\\mobile_number\\Plugin\\Validation\\Constraint\\MobileNumberValidator';
  }

}

Members