Skip to content

Commit 2f69f29

Browse files
committed
Handling direct link, instead of search and then go to the suggestion.
1 parent a41919a commit 2f69f29

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

modules/elasticsearch_connector_search_api/elasticsearch_connector_search_api.module

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ function elasticsearch_connector_search_api_form_views_exposed_form_alter(array
295295
// We need the _entity_views_field_identifier() function to translate Search
296296
// API field names into Views identifiers.
297297
module_load_include('views.inc', 'entity', 'views/entity');
298+
$include_js = FALSE;
298299
foreach ($fields as $field) {
299300
$field = _entity_views_field_identifier($field, array());
300301
if (!empty($view->filter[$field]->options['expose']['identifier'])) {
@@ -305,14 +306,16 @@ function elasticsearch_connector_search_api_form_views_exposed_form_alter(array
305306
$form[$key]['#attributes'] = array(
306307
'class' => array('elasticsearch-autocomplete')
307308
);
308-
309-
$form['#attached']['js'] = array(
310-
drupal_get_path('module', 'elasticsearch_connector_search_api') . '/js/elasticsearch_connector_search_api_autocomplete.js',
311-
);
309+
$include_js = TRUE;
312310
}
313311
}
314312
}
315313
}
314+
315+
if ($include_js) {
316+
$form['#attached']['js'][] =
317+
drupal_get_path('module', 'elasticsearch_connector_search_api') . '/js/elasticsearch_connector_search_api_autocomplete.js';
318+
}
316319
}
317320

318321
/**

0 commit comments

Comments
 (0)