See also: Writing Registry Plugins and Identifier Validation
Plugin Requirements
The name of the Plugin should match the format FooIdentifierValidator
.
The Plugin must implement a validation routine in the FooIdentifierValidator model, as described below.
XXX update for instantiation
Validation
The Plugin must implement a validation routine in the FooIdentifierValidator
model, with the following signature:
public function validate($identifier, $coIdentifierValidator, $coExtendedType)
where
- identifier: The identifier (or Email Address) to be validated.
- coIdentifierValidator: An array of configuration information about this validator, corresponding to cm_co_identifier_validators.
- coExtendedType: An array of extended type information describing the
$identifier
type. Corresponds to cm_co_extended_types, but for Email Addresses and Identifiers only.
Return Values
If validate
determines the $identifier
to be acceptable/valid, it returns true
. Otherwise, the function should throw an exception in accordance with the type of error.
- InvalidArgumentException: The identifier is not in an acceptable format. (eg: The identifier has non alpha-numeric characters.)
- OverflowException: The identifier is already in use. (eg: The identifier is already a mail alias.)
- RuntimeException: Any other type of error.
The message passed with the exception should be a localized string suitable for display to the user.