class NifConstraint in Field NIF 8
Checks if field_nif value is valid.
Plugin annotation
@Constraint(
id = "NifValue",
label = @Translation("NIF/CIF/NIE number constraint", context = "Validation"),
)
Hierarchy
- class \Drupal\field_nif\Plugin\Validation\Constraint\NifConstraint extends \Symfony\Component\Validator\Constraint
Expanded class hierarchy of NifConstraint
File
- src/
Plugin/ Validation/ Constraint/ NifConstraint.php, line 15
Namespace
Drupal\field_nif\Plugin\Validation\ConstraintView source
class NifConstraint extends Constraint {
/**
* The default violation message.
*
* @var string
*/
public $message = '@value is not a valid @document_type document number.';
/**
* The supported types.
*
* @var array
*/
public $supportedTypes;
/**
* Gets the violation message.
*
* @return string
*/
public function getMessage() {
return $this->message;
}
/**
* Gets the supported types as array.
*
* @return array
*/
public function getSupportedTypes() {
return $this->supportedTypes;
}
/**
* {@inheritdoc}
*/
public function validatedBy() {
return '\\Drupal\\field_nif\\Plugin\\Validation\\Constraint\\NifValueValidator';
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NifConstraint:: |
public | property | The default violation message. | |
NifConstraint:: |
public | property | The supported types. | |
NifConstraint:: |
public | function | Gets the violation message. | |
NifConstraint:: |
public | function | Gets the supported types as array. | |
NifConstraint:: |
public | function | Returns the name of the class that validates this constraint. |