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 ({@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.

Method Details

Hide inherited methods

__construct() public method

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

            
getHint() public method

public string|null getHint ( )

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

            
getId() public method

public string|null getId ( )

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

            
getLabel() public method

public string|null getLabel ( )

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

            
getName() public method

public string|null getName ( )

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

            
getPlaceholder() public method

public string|null getPlaceholder ( )

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

            
getValidationErrors() public method

public array getValidationErrors ( )

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

            
getValidationRules() public method

public mixed getValidationRules ( )

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

            
getValue() public method

public mixed getValue ( )

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

            
isValidated() public method

public boolean isValidated ( )

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