Skip to content

Latest commit

 

History

History
57 lines (38 loc) · 780 Bytes

text.mdx

File metadata and controls

57 lines (38 loc) · 780 Bytes

Text

A single-line text input.


PHP API

Field::text(string $key): TextField

Inherits all common fluent methods.

No type-specific fluent methods.


Storage

Stored as a plain string in the JSON blob.

{ "client_name": "Acme Corp" }

Sanitized with sanitize_text_field() before storage — strips tags, trims whitespace.


Example

Field::text('client_name')
    ->label('Client Name')
    ->placeholder('Enter client name')
    ->required()
    ->setIndex(true)
    ->adminColumn(true)
    ->adminColumnSortable(true),

Template usage

{{ ctrlfield_get('client_name') }}
<?= esc_html(ctrlfield_get('client_name')) ?>
{{ ctrlfield_get('client_name') }}