You are here

class CountryConstraint in Address 8

Country constraint.

Plugin annotation


@Constraint(
  id = "Country",
  label = @Translation("Country", context = "Validation"),
)

Hierarchy

  • class \Drupal\address\Plugin\Validation\Constraint\CountryConstraint extends \Symfony\Component\Validator\Constraint

Expanded class hierarchy of CountryConstraint

1 file declares its use of CountryConstraint
CountryConstraintValidatorTest.php in tests/src/Unit/Plugin/Validation/Constraint/CountryConstraintValidatorTest.php

File

src/Plugin/Validation/Constraint/CountryConstraint.php, line 15

Namespace

Drupal\address\Plugin\Validation\Constraint
View source
class CountryConstraint extends Constraint {

  /**
   * List of available countries.
   *
   * @var string[]
   */
  public $availableCountries = [];

  /**
   * Validation message if a country is invalid.
   *
   * @var string
   */
  public $invalidMessage = 'The country %value is not valid.';

  /**
   * Validation message if a country is not available.
   *
   * @var string
   */
  public $notAvailableMessage = 'The country %value is not available.';

}

Members

Namesort descending Modifiers Type Description Overrides
CountryConstraint::$availableCountries public property List of available countries.
CountryConstraint::$invalidMessage public property Validation message if a country is invalid.
CountryConstraint::$notAvailableMessage public property Validation message if a country is not available.