EmailAddress Field Type: comparison of v.2 vs v.3
Versions Compared
Old Version 2
changes.mady.by.user Dominika Kurek
Saved on Apr 29, 2016
compared with
New Version Current
changes.mady.by.user André Rømcke
Saved on Jan 04, 2017
Key
- This line was added.
- This line was removed.
- Formatting was changed.
This Field Type represents an email address, in the form of a string.
| Name | Internal name | Expected input type |
|---|---|---|
| EmailAddress | ezemail | string |
Description
The EmailAddress Field Type stores an email address, which is provided as a string.
PHP API Field Type
Value object
Properties
The Value class of this field type contains the following properties:
| Property | Type | Description |
|---|---|---|
| string | This property will be used for the input string provided as email address. |
| Code Block | ||||||
|---|---|---|---|---|---|---|
|
||||||
use eZ\Publish\Core\FieldType\EmailAddress\Type; // Instantiates an EmailAddress Value object with default value (empty string) $emailaddressValue = new Type\Value(); // Email definition $emailaddressValue->email = "[email protected]"; |
Constructor
The EmailAddress\Value constructor will initialize a new Value object with the value provided. It accepts a string as input.
| Code Block | ||||||
|---|---|---|---|---|---|---|
|
||||||
use eZ\Publish\Core\FieldType\EmailAddress\Type; // Instantiates an EmailAddress Value object $emailaddressValue = new Type\Value( "[email protected]" ); |
String representation
String representation of the Field Type's Value object is the email address contained in it.
Example:
Hash format
Hash value for this Field Type's Value is simply the email address as a string.
Example:
Validation
This Field Type uses the EmailAddressValidator validator as a resource which will test the string supplied as input against a pattern, to make sure that a valid email address has been provided.
If the validations fail a ValidationError is thrown, specifying the error message.
Settings
This Field Type does not support settings.
Comments
Add a comment