abstract class TextBase extends BaseControl

Base for text-based controls (TextInput, TextArea) with nullable and empty-value support.

Properties

protected $emptyValue
protected $rawValue

Methods

setValue(mixed $value)

No description

mixed
getValue()

Returns the value, substituting empty string when it matches the empty value. Returns null when nullable is set and value is empty.

setNullable(bool $value = true)

Sets whether getValue() returns null instead of empty string.

bool
isNullable()

No description

setEmptyValue(string $value)

Sets the special value which is treated as empty string.

string
getEmptyValue()

Returns the special value which is treated as empty string.

setMaxLength(int|null $length)

Sets the maximum number of allowed characters.

Html|string
getControl()

Generates control's HTML element.

string|null
getRenderedValue()

No description

addRule(callable|string $validator, string|Stringable|null $errorMessage = null, mixed $arg = null)

No description

Details

at line 31
Control setValue(mixed $value)

internal  
 

No description

Parameters

mixed $value

Return Value

Control

at line 49
mixed getValue()

Returns the value, substituting empty string when it matches the empty value. Returns null when nullable is set and value is empty.

Return Value

mixed

at line 61
TextBase setNullable(bool $value = true)

Sets whether getValue() returns null instead of empty string.

Parameters

bool $value

Return Value

TextBase

at line 68
bool isNullable()

No description

Return Value

bool

at line 77
TextBase setEmptyValue(string $value)

Sets the special value which is treated as empty string.

Parameters

string $value

Return Value

TextBase

at line 87
string getEmptyValue()

Returns the special value which is treated as empty string.

Return Value

string

at line 96
TextBase setMaxLength(int|null $length)

Sets the maximum number of allowed characters.

Parameters

int|null $length

Return Value

TextBase

at line 103
Html|string getControl()

Generates control's HTML element.

Return Value

Html|string

at line 118
protected string|null getRenderedValue()

No description

Return Value

string|null

at line 130
BaseControl addRule(callable|string $validator, string|Stringable|null $errorMessage = null, mixed $arg = null)

No description

Parameters

callable|string $validator
string|Stringable|null $errorMessage
mixed $arg

Return Value

BaseControl