Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions modules/search/class.jetpack-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,24 @@ public function load_assets() {
$script_version = self::get_asset_version( $script_relative_path );
$script_path = plugins_url( $script_relative_path, JETPACK__PLUGIN_FILE );
wp_enqueue_script( 'jetpack-instant-search', $script_path, array(), $script_version, true );
$_blog_id = Jetpack::get_option( 'id' );

$filters = Jetpack_Search_Helpers::get_filters_from_widgets();
$widgets = array();
foreach( $filters as $key => $filter ) {
if ( ! isset( $widgets[$filter[ 'widget_id' ]] ) ) {
$widgets[$filter[ 'widget_id' ]][ 'filters' ] = array();
$widgets[$filter[ 'widget_id' ]][ 'widget_id' ] = $filter[ 'widget_id' ];
}
$new_filter = $filter;
$new_filter[ 'filter_id' ] = $key;
$widgets[$filter[ 'widget_id' ]][ 'filters' ][] = $new_filter;
}

// This is probably a temporary filter for testing the prototype.
$options = array(
'siteId' => $_blog_id,
'postTypes' => get_post_types(),
'siteId' => Jetpack::get_option( 'id' ),
'widgets' => array_values( $widgets ),
);
/**
* Customize Instant Search Options.
Expand All @@ -221,9 +235,7 @@ public function load_assets() {
$options = apply_filters( 'jetpack_instant_search_options', $options );

wp_localize_script(
'jetpack-instant-search',
'jetpack_instant_search_options',
$options
'jetpack-instant-search', 'JetpackInstantSearchOptions', $options
);
}

Expand Down
28 changes: 0 additions & 28 deletions modules/search/instant-search/components/api.js

This file was deleted.

Loading