Have you seen our new video tutorials? Check it out!

Email Field Type

The email field type provides a secure email input.

Introduction

anomaly.field_type.email

The email field type provides a secure email input.

Configuration

Below is the full configuration available with defaults values:

"example" => [
    "type"   => "anomaly.field_type.email",
    "config" => [
        "default_value" => null
    ]
]
Configuration
Key Example Description

default_value

[email protected]

The default value.

Usage

This section will show you how to use the field type via API and in the view layer.

Setting Values

You can set the email field type value with any valid email.

$entry->example = "[email protected]";

Basic Output

The email field type returns null or the email value.

$entry->example; // [email protected]

Presenter Output

This section will show you how to use the decorated value provided by the \Anomaly\EmailFieldType\EmailFieldTypePresenter class.

EmailFieldTypePresenter::mailto()

The mailto method returns an HTML mailto link.

Returns: string
Arguments
Key Required Type Default Description

$text

false

string

The email address.

The text of the link.

$attributes

false

array

null

The HTML attributes of the link.

Example
$decorated->example->mailto('Email me!', ['class' => 'btn btn-success']);
Twig
{{ decorated.example.mailto('Email me!', {'class': 'btn btn-success'})|raw }}

EmailFieldTypePresenter::obfuscated()

The obfuscated method returns the obfuscated email.

Returns: string
Example
$decorated->example->obfuscated();
Twig
{{ decorated.example.obfuscated()|raw }}