Introduction

anomaly.field_type.text

The text field type provides a text input with some convenient outputs.

Configuration

Below is the full configuration available with defaults values:

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

type

password

The input type. Valid options are text (default), password, or any other valid input type.

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 text field type value with any compatible value.

$entry->example = "Example Text";

Basic Output

The text field type returns null or the string value.

$entry->example; // Test String

Presenter Output

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

TextFieldTypePresenter::tel()

The tel method returns an HTML tel link.

Returns: string
Arguments
Key Required Type Default Description

$text

false

string

The phone number as entered.

The text of the link.

$attributes

false

array

null

The HTML attributes of the link.

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