Skip to content

Commit 094cab6

Browse files
committed
radio buttons - first pass at semantic markup
1 parent feb466a commit 094cab6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

a11y-add-on-for-facetwp.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,21 @@ function a11y_addon_transform_facet_markup( $output, $params ) {
117117

118118
$output = str_replace('class=', $id_string, $output);
119119

120+
case 'radio':
121+
$output = '<div class="facetwp-facet facet-wrap facetwp-type-radio" role="radiogroup" id="'.esc_attr( $params['facet']['name'] ).'">';
122+
foreach( $params['values'] as $value ) {
123+
$output .= sprintf(
124+
'<input type="radio" id="%1$s" name="%3$s" value="%2$s">
125+
<label for="%1$s">%2$s</label><br/>',
126+
esc_attr( 'radio-'.$value['facet_value'] ),
127+
esc_html( $value['facet_display_value'] ),
128+
esc_attr( $params['facet']['name'] )
129+
);
130+
}
131+
132+
$output .= '</div>';
133+
break;
134+
120135
default:
121136

122137
$id_string = 'id="'.$params['facet']['name'].'" class=';

0 commit comments

Comments
 (0)