below the input * string|null $id — override the id attribute (defaults to $name) * array $attrs — extra HTML attributes as key=>value pairs (e.g. min/max for number) * string|null $errorFieldName — when set and matches $name, adds aria-invalid + aria-errormessage * * The partial does NOT call htmlspecialchars on $value — the caller is responsible. */ $type = $type ?? 'text'; $required = $required ?? false; $placeholder = $placeholder ?? ''; $hint = $hint ?? null; $id = $id ?? $name; $attrs = $attrs ?? []; $errorFieldName = $errorFieldName ?? null; // Build hint id for aria-describedby $hintId = ($hint !== null) ? ($id . '-hint') : null; // Build describedby string (hint + error) $describedBy = []; if ($hintId !== null) $describedBy[] = $hintId; if ($errorFieldName === $name) $describedBy[] = 'flash-error'; $ariaDescribedBy = !empty($describedBy) ? ' aria-describedby="' . implode(' ', $describedBy) . '"' : ''; $attrStr = ''; foreach ($attrs as $k => $v) { if ($v === true) { $attrStr .= ' ' . htmlspecialchars($k); } else { $attrStr .= ' ' . htmlspecialchars($k) . '="' . htmlspecialchars((string)$v) . '"'; } } $ariaInvalid = ($errorFieldName === $name) ? ' aria-invalid="true" aria-errormessage="flash-error"' : ''; ?>