; default '' * set to null to suppress the empty option entirely * string|null $id — override the id attribute (defaults to $name) * string|null $hint — optional hint shown in below the select * string|null $errorFieldName — when set and matches $name, adds aria-invalid + aria-errormessage */ $required = $required ?? false; $placeholder = array_key_exists('placeholder', get_defined_vars()) ? $placeholder : ''; $id = $id ?? $name; $hint = $hint ?? null; $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) . '"' : ''; $ariaInvalid = ($errorFieldName === $name) ? ' aria-invalid="true" aria-errormessage="flash-error"' : ''; ?>
$v) { if ($v === true) { $selectAttrStr .= ' ' . htmlspecialchars($k); } else { $selectAttrStr .= ' ' . htmlspecialchars($k) . '="' . htmlspecialchars((string)$v) . '"'; } } ?>