Skip to content

Commit 4dacfee

Browse files
committed
moved id code to switch statement
1 parent a4d1dc6 commit 4dacfee

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

a11y-add-on-for-facetwp.php

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,6 @@ function a11y_addon_facet_assets() {
4949
add_action( 'wp_enqueue_scripts', 'a11y_addon_facet_assets' );
5050

5151

52-
/**
53-
* Add class to all filters
54-
* @link https://facetwp.com/documentation/developers/output/facetwp_facet_html/
55-
*/
56-
function a11y_addon_add_facet_class( $output, $params ){
57-
58-
if ( 'dropdown' == $params['facet']['type'] ) {
59-
$output = str_replace( 'facetwp-dropdown', 'facetwp-dropdown a11y-addon-filter', $output );
60-
}
61-
62-
$label = str_replace( ' ','', $params['facet']['label'] );
63-
$id_string = 'id="'.$label.'" class=';
64-
$output = str_replace('class=', $id_string, $output);
65-
66-
return $output;
67-
}
68-
69-
add_filter( 'facetwp_facet_html', 'a11y_addon_add_facet_class', 20, 2);
70-
7152
/**
7253
* Adjusts markup for specific facets so they use real input elements
7354
*
@@ -132,10 +113,15 @@ function a11y_addon_transform_facet_markup( $output, $params ) {
132113
$output = str_replace( 'facetwp-dropdown', 'facetwp-dropdown a11y-addon-filter', $output );
133114

134115
$id_string = 'id="'.$params['facet']['name'].'" class=';
135-
116+
117+
$output = str_replace('class=', $id_string, $output);
118+
119+
default:
120+
121+
$id_string = 'id="'.$params['facet']['name'].'" class=';
122+
136123
$output = str_replace('class=', $id_string, $output);
137124

138-
139125
/*
140126
//do we want this?
141127
case 'pager':

0 commit comments

Comments
 (0)