Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed PHP autosuggest placeholder is not being used. #1619

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
8 changes: 3 additions & 5 deletions assets/js/autosuggest.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,10 @@ function replaceGlobally( string, term, replacement ) {
* Build the search query from the search text
*
* @param searchText - string
* @param placeholder - string
* @param { query } - desructured json query string
* @param { query, placeholder } - desructured json query string and placeholder
* @returns json string
*/
function buildSearchQuery( searchText, placeholder, { query } ) {
function buildSearchQuery( searchText, { query, placeholder } ) {
const newQuery = replaceGlobally( query, placeholder, searchText );
return newQuery;
}
Expand Down Expand Up @@ -401,7 +400,6 @@ if ( epas.endpointUrl && '' !== epas.endpointUrl ) {
}

const searchText = $localInput.val();
const placeholder = 'ep_autosuggest_placeholder';
const queryJSON = getJsonQuery();

if( queryJSON.error ) {
Expand All @@ -416,7 +414,7 @@ if ( epas.endpointUrl && '' !== epas.endpointUrl ) {
const weightingSettings = Object.assign( {}, epas.weightingDefaults, epas.weighting );

if ( 2 <= searchText.length ) {
query = buildSearchQuery( searchText, placeholder, queryJSON );
query = buildSearchQuery( searchText, queryJSON );
request = esSearch( query, searchText );

request.done( ( response ) => {
Expand Down