Skip to content

FieldNameResolver

Turns an element’s name attribute into the parameter path its value lives under, resolving the empty brackets HTML uses for repeated fields.

A form can name three inputs tags[], and the browser submits them as a list. Nothing in the markup says which one is index 0, so position in the document decides — which means resolving a name is stateful across the elements of one form. That state is this object: one instance per form, fed each element in document order.

foo[][3] and the like are refused for checkable inputs, where [] carries the separate meaning of “this is one of a group sharing a name” and so must appear once, at the end.

final class FieldNameResolver

SourceUtil/FormPopulation/FieldNameResolver.php
MethodDescription
resolve(string $name, bool $isCheckable, bool $isMultipleSelect): ?ResolvedFieldNameResolves one element’s name, or null when the element should be skipped.

public function resolve(string $name, bool $isCheckable, bool $isMultipleSelect): ?ResolvedFieldName

Resolves one element’s name, or null when the element should be skipped.

ParameterTypeDescription
$namestring
$isCheckablebool
$isMultipleSelectbool

Returns ?ResolvedFieldName