add id and label for a select in a facet

<?php
/** 
 ** adds a id and label to a select in a facet such as dropdown
 ** excludes fselects which have a hidden select but display
 ** as a div element styled to look and behave as a dropdown
 **/

add_filter( 'facetwp_facet_html', function( $output, $params ) {
    if ( 'fselect' != $params['facet']['type'] && ( empty( $params['facet']['ui_type'] ) || 'fselect' != $params['facet']['ui_type'] ) ) {
        $output = str_replace ( '<select ' , '<select id="facet-' . $params['facet']['name'] . '" ' , $output );
        $output = str_replace ( '<select' , '<label for="facet-' . $params['facet']['name'] . '">' . $params['facet']['label'] . '</label><select', $output );
    }
    return $output;
}, 10, 2 );