Final Class Yiisoft\Form\PureField\InputData
| Inheritance | Yiisoft\Form\PureField\InputData |
|---|---|
| Implements | Yiisoft\Form\Field\Base\InputData\InputDataInterface |
Simple input data implementation that can be used within this package. All parameters are passed from outer scope.
Regarding validation, it does not support state and rules, stores the result errors only. For more advanced implementation take a look at form model ({@link https://github.com/yiisoft/form-model}) package.
To simplify adding to field, {@see \Yiisoft\Form\PureField\Field} helper or {@see \Yiisoft\Form\PureField\FieldFactory} can be used.
Public Methods
Method Details
| public mixed __construct ( string|null $name = null, mixed $value = null, string|null $label = null, string|null $hint = null, string|null $placeholder = null, string|null $id = null, mixed $validationRules = null, string[] $validationErrors = null ) | ||
| $name | string|null | |
| $value | mixed | |
| $label | string|null | |
| $hint | string|null | |
| $placeholder | string|null | |
| $id | string|null | |
| $validationRules | mixed | |
| $validationErrors | string[] | |
public function __construct(
private readonly ?string $name = null,
private readonly mixed $value = null,
private readonly ?string $label = null,
private readonly ?string $hint = null,
private readonly ?string $placeholder = null,
private readonly ?string $id = null,
private readonly mixed $validationRules = null,
private readonly ?array $validationErrors = null,
) {
}
| public string|null getPlaceholder ( ) |
public function getPlaceholder(): ?string
{
return $this->placeholder;
}
| public array getValidationErrors ( ) |
public function getValidationErrors(): array
{
return $this->validationErrors ?? [];
}
| public mixed getValidationRules ( ) |
public function getValidationRules(): mixed
{
return $this->validationRules;
}
| public boolean isValidated ( ) |
public function isValidated(): bool
{
return $this->validationErrors !== null;
}
Signup or Login in order to comment.