You are here

class AddressFormatConstraint in Address 8

Address format constraint.

Plugin annotation


@Constraint(
  id = "AddressFormat",
  label = @Translation("Address Format", context = "Validation"),
  type = { "address" }
)

Hierarchy

  • class \Drupal\address\Plugin\Validation\Constraint\AddressFormatConstraint extends \CommerceGuys\Addressing\Validator\Constraints\AddressFormatConstraint

Expanded class hierarchy of AddressFormatConstraint

File

src/Plugin/Validation/Constraint/AddressFormatConstraint.php, line 16

Namespace

Drupal\address\Plugin\Validation\Constraint
View source
class AddressFormatConstraint extends ExternalAddressFormatConstraint {

  /**
   * Whether extended postal code validation is enabled.
   *
   * Extended postal code validation uses subdivision-level patterns to
   * in addition to the country-level pattern supplied by the address format.
   *
   * This feature is deprecated in the parent library, and undesired
   * on the Drupal side.
   *
   * @var bool
   */
  public $extendedPostalCodeValidation = FALSE;

  /**
   * Validation message if a field must be blank.
   *
   * @var string
   */
  public $blankMessage = '@name field must be blank.';

  /**
   * Validation message if a field is required.
   *
   * @var string
   */
  public $notBlankMessage = '@name field is required.';

  /**
   * Validation message if a field has an invalid format.
   *
   * @var string
   */
  public $invalidMessage = '@name field is not in the right format.';

}

Members

Namesort descending Modifiers Type Description Overrides
AddressFormatConstraint::$blankMessage public property Validation message if a field must be blank.
AddressFormatConstraint::$extendedPostalCodeValidation public property Whether extended postal code validation is enabled.
AddressFormatConstraint::$invalidMessage public property Validation message if a field has an invalid format.
AddressFormatConstraint::$notBlankMessage public property Validation message if a field is required.