0 follower

Final Class Yiisoft\Form\PureField\InputData

InheritanceYiisoft\Form\PureField\InputData
ImplementsYiisoft\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.

Method Details

Hide inherited methods

__construct() public method

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,
) {}

            
getHint() public method

public getHint( ): string|null

                public function getHint(): ?string
{
    return $this->hint;
}

            
getId() public method

public getId( ): string|null

                public function getId(): ?string
{
    return $this->id;
}

            
getLabel() public method

public getLabel( ): string|null

                public function getLabel(): ?string
{
    return $this->label;
}

            
getName() public method

public getName( ): string|null

                public function getName(): ?string
{
    return $this->name;
}

            
getPlaceholder() public method

public getPlaceholder( ): string|null

                public function getPlaceholder(): ?string
{
    return $this->placeholder;
}

            
getValidationErrors() public method

public getValidationErrors( ): array

                public function getValidationErrors(): array
{
    return $this->validationErrors ?? [];
}

            
getValidationRules() public method

public getValidationRules( ): mixed

                public function getValidationRules(): mixed
{
    return $this->validationRules;
}

            
getValue() public method

public getValue( ): mixed

                public function getValue(): mixed
{
    return $this->value;
}

            
isValidated() public method

public isValidated( ): boolean

                public function isValidated(): bool
{
    return $this->validationErrors !== null;
}