This field type represents an email address, in the form of a string.

NameInternal nameExpected input type
EmailAddressezemailstring

Table of contents:

Description


The EmailAddress FieldType stores an email address, which is provided as a string.

Value object


Properties

The Value class of this field type contains the following properties:

PropertyTypeDescription
$emailstringThis property will be used for the input string provided as email address.
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 = "someuser@example.com";

Constructor

The EmailAddress\Value constructor will initialize a new Value object with the value provided. It accepts a string as input.

use eZ\Publish\Core\FieldType\EmailAddress\Type;
 
// Instantiates an EmailAddress Value object
$emailaddressValue = new Type\Value( "someuser@example.com" );

String representation

String representation of FieldType's Value object is the email address contained in it.

Example:

someuser@example.com

Hash format

Hash value for this FieldType's Value is simply the email address as a string.

Example:

someuser@example.com

Validation


This FieldType  uses the EmailAddressValidator validator as 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 FieldType does not support settings.