mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 13:21:36 +01:00
add label ids to html_radios
This commit is contained in:
@@ -127,11 +127,16 @@ function smarty_function_html_radios($params, &$smarty)
|
||||
|
||||
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels) {
|
||||
$_output = '';
|
||||
if ($labels) $_output .= '<label>';
|
||||
$_output .= '<input type="radio" name="'
|
||||
if ($labels) {
|
||||
$_id = smarty_function_escape_special_chars($name . '_' . $value);
|
||||
$_output .= '<label for="' . $_id . '">';
|
||||
}
|
||||
$_output .= '<input type="radio" name="'
|
||||
. smarty_function_escape_special_chars($name) . '" value="'
|
||||
. smarty_function_escape_special_chars($value) . '"';
|
||||
|
||||
if ($labels) $_output .= ' id="' . $_id . '"';
|
||||
|
||||
if ($value==$selected) {
|
||||
$_output .= ' checked="checked"';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user