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 (https://github.com/yiisoft/form-model) package.
To simplify adding to field, Yiisoft\Form\PureField\Field helper or Yiisoft\Form\PureField\FieldFactory can be used.
Public Methods
Method Details
| public __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 ): mixed | ||
| $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 getPlaceholder( ): string|null |
public function getPlaceholder(): ?string
{
return $this->placeholder;
}
| public getValidationErrors( ): array |
public function getValidationErrors(): array
{
return $this->validationErrors ?? [];
}
| public getValidationRules( ): mixed |
public function getValidationRules(): mixed
{
return $this->validationRules;
}
| public isValidated( ): boolean |
public function isValidated(): bool
{
return $this->validationErrors !== null;
}
Signup or Login in order to comment.