<?php
// Each facet's source now can be accessed in JavaScript with FWP.settings.facet_sources['your_facet_name']
add_filter( 'facetwp_render_output', function( $output, $params ) {
$sources = [];
foreach ( FWP()->facet->facets as $facet_name => $facet_data ) {
if ( isset ( $facet_data['source'] ) ) {
$sources[ $facet_name ] = $facet_data['source'];
}
}
$output['settings']['facet_sources'] = $sources;
return $output;
}, 10, 2 );