BaseControl
abstract class BaseControl extends Component implements Control
Base class that implements the basic functionality common to form controls.
Properties
static | $idMask | ||
mixed | $value | ||
Html read-only | $control | ||
Html read-only | $label | ||
bool | $disabled | ||
string|bool|null | $htmlId | ||
string|Stringable | $caption | ||
bool | $omitted | ||
bool | $required | ||
Form read-only | $form | ||
string read-only | $htmlName | ||
Html read-only | $controlPrototype | ||
Html read-only | $labelPrototype | ||
bool read-only | $filled | ||
array read-only | $errors | ||
array read-only | $options | ||
string read-only | $error |
Methods
No description
Sets textual caption or label.
No description
Returns form.
Loads HTTP data.
Loads HTTP data.
Returns HTML name of control.
Returns control's value.
Is control filled?
Sets control's default value.
Disables or enables control.
Is control disabled?
Sets whether control value is excluded from $form->getValues() result.
Is control value excluded from $form->getValues() result?
Generates control's HTML element.
Generates label's HTML element.
No description
No description
Returns control's HTML element template.
Returns label's HTML element template.
Changes control's HTML id.
Returns control's HTML id.
Changes control's HTML attribute.
Sets translate adapter.
Returns translate adapter.
Returns translated string.
Adds a validation rule.
Adds a validation condition a returns new branch.
Adds a validation condition based on another control a returns new branch.
Adds a input filter callback.
Makes control mandatory.
Is control mandatory?
Performs the server side validation.
Adds error message to the list.
Returns errors corresponding to control.
Returns errors corresponding to control.
No description
No description
Sets user-specific option.
Returns user-specific option.
Returns user-specific options.
No description
No description
Details
at line 76
__construct(string|Stringable|null $caption = null)
No description
at line 94
BaseControl
setCaption(string|Stringable $caption)
Sets textual caption or label.
at line 101
string|Stringable|null
getCaption()
No description
at line 110
Form|null
getForm(bool $throw = true)
Returns form.
at line 119
void
loadHttpData()
Loads HTTP data.
at line 128
protected mixed
getHttpData($type, string|null $htmlTail = null)
Loads HTTP data.
at line 137
string
getHtmlName()
Returns HTML name of control.
at line 150
Control
setValue(mixed $value)
internal |
Sets control's value.
at line 160
mixed
getValue()
Returns control's value.
at line 169
bool
isFilled()
Is control filled?
at line 179
BaseControl
setDefaultValue($value)
Sets control's default value.
at line 193
BaseControl
setDisabled(bool $value = true)
Disables or enables control.
at line 208
bool
isDisabled()
Is control disabled?
at line 217
BaseControl
setOmitted(bool $value = true)
Sets whether control value is excluded from $form->getValues() result.
at line 227
bool
isOmitted()
Is control value excluded from $form->getValues() result?
at line 239
Html|string
getControl()
Generates control's HTML element.
at line 257
Html|string|null
getLabel(string|Stringable|null $caption = null)
Generates label's HTML element.
at line 268
Html|null
getControlPart()
No description
at line 274
Html|null
getLabelPart()
No description
at line 283
Html
getControlPrototype()
Returns control's HTML element template.
at line 292
Html
getLabelPrototype()
Returns label's HTML element template.
at line 301
BaseControl
setHtmlId(string|bool|null $id)
Changes control's HTML id.
at line 311
string|bool|null
getHtmlId()
Returns control's HTML id.
at line 328
BaseControl
setHtmlAttribute(string $name, mixed $value = true)
Changes control's HTML attribute.
at line 348
BaseControl
setAttribute(string $name, mixed $value = true)
deprecated
deprecated
No description
at line 360
BaseControl
setTranslator(Translator|null $translator)
Sets translate adapter.
at line 370
Translator|null
getTranslator()
Returns translate adapter.
at line 385
mixed
translate($value, ...$parameters)
Returns translated string.
at line 406
BaseControl
addRule(callable|string $validator, string|Stringable|null $errorMessage = null, mixed $arg = null)
Adds a validation rule.
at line 420
Rules
addCondition($validator, $value = null)
Adds a validation condition a returns new branch.
at line 429
Rules
addConditionOn(Control $control, $validator, $value = null)
Adds a validation condition based on another control a returns new branch.
at line 438
BaseControl
addFilter(callable $filter)
Adds a input filter callback.
at line 445
Rules
getRules()
No description
at line 454
BaseControl
setRequired(string|Stringable|bool $value = true)
Makes control mandatory.
at line 464
bool
isRequired()
Is control mandatory?
at line 473
void
validate()
Performs the server side validation.
at line 487
void
addError(string|Stringable $message, bool $translate = true)
Adds error message to the list.
at line 496
string|null
getError()
Returns errors corresponding to control.
at line 505
array
getErrors()
Returns errors corresponding to control.
at line 511
bool
hasErrors()
No description
at line 517
void
cleanErrors()
No description
at line 529
BaseControl
setOption($key, mixed $value)
Sets user-specific option.
at line 544
mixed
getOption($key)
Returns user-specific option.
at line 557
array
getOptions()
Returns user-specific options.
at line 566
mixed
__call(string $name, array $args)
No description
at line 581
static void
extensionMethod(string $name, $callback)
No description