FieldValueApplier
Writes a submitted value onto the form element that carries it.
Each control type says “this is my value” differently — an attribute for a text input, the presence of checked for a checkbox, selected on a child option for a select, and the element’s text for a textarea — so this is where knowledge of those four shapes lives.
Removing the rendered state before setting the new one is deliberate throughout: a checkbox the view rendered as checked must come back unchecked when the submission did not include it, and a value the view rendered must not survive a submission that cleared the field.
Synopsis
Section titled “Synopsis”final readonly class FieldValueApplier
| Source | Util/FormPopulation/FieldValueApplier.php |
Constructor
Section titled “Constructor”__construct()
Section titled “__construct()”public function __construct(DOMDocument $document, DocumentEncoding $encoding, string $xmlnsPrefix, bool $useCdataForTextareas, bool $includeHiddenInputs, bool $includePasswordInputs, \Closure(string, ?\DOMElement): array<int, \DOMElement> $queryElements): mixed
XPath against the document.
| Parameter | Type | Description |
|---|---|---|
$document | DOMDocument | |
$encoding | DocumentEncoding | |
$xmlnsPrefix | string | |
$useCdataForTextareas | bool | |
$includeHiddenInputs | bool | |
$includePasswordInputs | bool | |
$queryElements | \Closure(string, ?\DOMElement): array<int, \DOMElement> | XPath against the document. |
Returns mixed
Methods
Section titled “Methods”| Method | Description |
|---|---|
apply(DOMElement $element, ResolvedFieldName $name, mixed $value, ParameterHolder $parameters): bool | Applies the submitted value for $name to $element. |
apply()
Section titled “apply()”public function apply(DOMElement $element, ResolvedFieldName $name, mixed $value, ParameterHolder $parameters): bool
Applies the submitted value for $name to $element.
| Parameter | Type | Description |
|---|---|---|
$element | DOMElement | |
$name | ResolvedFieldName | |
$value | mixed | |
$parameters | ParameterHolder |
Returns bool — False when the element was left untouched, so the caller knows nothing was written for it.