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 $name null, mixed $value null, ?string $label null, ?string $hint null, ?string $placeholder null, ?string $id null, mixed $validationRules null, string[] $validationErrors null )
$name ?string
$value mixed
$label ?string
$hint ?string
$placeholder ?string
$id ?string
$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 getHint ( )

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

            
getId() public method

public ?string getId ( )

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

            
getLabel() public method

public ?string getLabel ( )

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

            
getName() public method

public ?string getName ( )

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

            
getPlaceholder() public method

public ?string 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;
}