BaseControl
abstract class BaseControl extends Component implements Control
Base class that implements the basic functionality common to form controls.
Properties
static string | $idMask | ||
mixed | $value | ||
Html read-only | $control | ||
Html read-only | $label | ||
bool | $disabled | ||
mixed | $htmlId | ||
string|object | $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 an 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 81
__construct(string|object $caption = null)
No description
at line 101
BaseControl
setCaption(object|string $caption)
Sets textual caption or label.
at line 109
object|string
getCaption()
No description
at line 119
Form|null
getForm(bool $throw = true)
Returns form.
at line 128
void
loadHttpData()
Loads HTTP data.
at line 138
protected mixed
getHttpData($type, string|null $htmlTail = null)
Loads HTTP data.
at line 147
string
getHtmlName()
Returns HTML name of control.
at line 161
Control
setValue(mixed $value)
internal |
Sets control's value.
at line 172
mixed
getValue()
Returns control's value.
at line 181
bool
isFilled()
Is control filled?
at line 192
BaseControl
setDefaultValue($value)
Sets control's default value.
at line 208
BaseControl
setDisabled(bool $value = true)
Disables or enables control.
at line 223
bool
isDisabled()
Is control disabled?
at line 233
BaseControl
setOmitted(bool $value = true)
Sets whether control value is excluded from $form->getValues() result.
at line 243
bool
isOmitted()
Is control value excluded from $form->getValues() result?
at line 256
Html|string
getControl()
Generates control's HTML element.
at line 275
Html|string|null
getLabel(string|object $caption = null)
Generates label's HTML element.
at line 286
Html|null
getControlPart()
No description
at line 292
Html|null
getLabelPart()
No description
at line 301
Html
getControlPrototype()
Returns control's HTML element template.
at line 310
Html
getLabelPrototype()
Returns label's HTML element template.
at line 321
BaseControl
setHtmlId(string|bool|null $id)
Changes control's HTML id.
at line 332
mixed
getHtmlId()
Returns control's HTML id.
at line 350
BaseControl
setHtmlAttribute(string $name, $value = true)
Changes control's HTML attribute.
at line 371
BaseControl
setAttribute(string $name, $value = true)
deprecated
deprecated
No description
at line 384
BaseControl
setTranslator(Translator|null $translator)
Sets translate adapter.
at line 394
Translator|null
getTranslator()
Returns translate adapter.
at line 410
mixed
translate($value, ...$parameters)
Returns translated string.
at line 434
BaseControl
addRule(callable|string $validator, string|object $errorMessage = null, $arg = null)
Adds a validation rule.
at line 444
Rules
addCondition($validator, $value = null)
Adds a validation condition a returns new branch.
at line 453
Rules
addConditionOn(Control $control, $validator, $value = null)
Adds a validation condition based on another control a returns new branch.
at line 463
BaseControl
addFilter(callable $filter)
Adds an input filter callback.
at line 470
Rules
getRules()
No description
at line 481
BaseControl
setRequired(bool|string|object $value = true)
Makes control mandatory.
at line 491
bool
isRequired()
Is control mandatory?
at line 500
void
validate()
Performs the server side validation.
at line 515
void
addError(string|object $message, bool $translate = true)
Adds error message to the list.
at line 524
string|null
getError()
Returns errors corresponding to control.
at line 533
array
getErrors()
Returns errors corresponding to control.
at line 539
bool
hasErrors()
No description
at line 545
void
cleanErrors()
No description
at line 558
BaseControl
setOption($key, $value)
Sets user-specific option.
at line 574
mixed
getOption($key)
Returns user-specific option.
at line 586
array
getOptions()
Returns user-specific options.
at line 595
__call(string $name, array $args)
No description
at line 610
static void
extensionMethod(string $name, $callback)
No description