diff --git a/search_autocomplete.autocomplete.inc b/search_autocomplete.autocomplete.inc index a2b76868fdbfa131d62d4879a87afdb56a9ad75f..c374d6c24df33d54350605ef7d6369e021391f11 100644 --- a/search_autocomplete.autocomplete.inc +++ b/search_autocomplete.autocomplete.inc @@ -65,11 +65,11 @@ function search_autocomplete_autocomplete($fid) { ->fetchAssoc(); $view = views_get_view($result['data_view']); - $viewToGetExposedFilters = views_get_view($result['data_view']); - $viewToGetExposedFilters->set_display('default'); - $viewToGetExposedFilters->is_cacheable = FALSE; - $viewToGetExposedFilters->execute(); - foreach ($viewToGetExposedFilters->exposed_raw_input as $key => $value) { + $view_exposed_filters = views_get_view($result['data_view']); + $view_exposed_filters->set_display('default'); + $view_exposed_filters->is_cacheable = FALSE; + $view_exposed_filters->execute(); + foreach ($view_exposed_filters->exposed_raw_input as $key => $value) { $view->exposed_input[$key] = $user_input; } diff --git a/search_autocomplete.features.inc b/search_autocomplete.features.inc index dd56bdafccabc4edc22ef405469af75a2f676220..018707c46e9337f8281bd7433293664d1ca6a1a3 100644 --- a/search_autocomplete.features.inc +++ b/search_autocomplete.features.inc @@ -1,7 +1,16 @@ $values['all_results_value'], 'link' => $values['all_results_link'], 'group' => array( - 'group_id' => 'all_results', + 'group_id' => 'all_results', ), ); $no_results = array( @@ -324,7 +324,7 @@ function search_autocomplete_form_configure_submit($form, &$form_state) { 'value' => $values['no_results_value'], 'link' => $values['no_results_link'], 'group' => array( - 'group_id' => 'no_results', + 'group_id' => 'no_results', ), ); diff --git a/search_autocomplete.install b/search_autocomplete.install index 2acb2f47d8c0dfda9a70858723c90e88f1d95108..8dc005ad4ddc681c67b893cbadf37b1922e56ff7 100644 --- a/search_autocomplete.install +++ b/search_autocomplete.install @@ -159,7 +159,7 @@ function search_autocomplete_install() { 'min_char' => $trigger, 'max_sug' => $limit, 'no_results' => json_encode(array( - 'label' => t('No results found for [search-phrase]. Click to perform full search.'), + 'label' => st('No results found for [search-phrase]. Click to perform full search.'), 'value' => '[search-phrase]', 'link' => '', 'group' => array( @@ -167,7 +167,7 @@ function search_autocomplete_install() { ), )), 'all_results' => json_encode(array( - 'label' => t('View all results for [search-phrase].'), + 'label' => st('View all results for [search-phrase].'), 'value' => '[search-phrase]', 'link' => '', 'group' => array( @@ -191,7 +191,7 @@ function search_autocomplete_install() { 'min_char' => $trigger, 'max_sug' => $limit, 'no_results' => json_encode(array( - 'label' => t('No results found for [search-phrase]. Click to perform full search.'), + 'label' => st('No results found for [search-phrase]. Click to perform full search.'), 'value' => '[search-phrase]', 'link' => '', 'group' => array( @@ -199,7 +199,7 @@ function search_autocomplete_install() { ), )), 'all_results' => json_encode(array( - 'label' => t('View all results for [search-phrase].'), + 'label' => st('View all results for [search-phrase].'), 'value' => '[search-phrase]', 'link' => '', 'group' => array( @@ -223,7 +223,7 @@ function search_autocomplete_install() { 'min_char' => $trigger, 'max_sug' => $limit, 'no_results' => json_encode(array( - 'label' => t('No results found for [search-phrase]. Click to perform full search.'), + 'label' => st('No results found for [search-phrase]. Click to perform full search.'), 'value' => '[search-phrase]', 'link' => '', 'group' => array( @@ -231,7 +231,7 @@ function search_autocomplete_install() { ), )), 'all_results' => json_encode(array( - 'label' => t('View all results for [search-phrase].'), + 'label' => st('View all results for [search-phrase].'), 'value' => '[search-phrase]', 'link' => '', 'group' => array( @@ -405,7 +405,8 @@ function search_autocomplete_update_7411(&$sandbox) { 'size' => 'big', ); db_add_field('search_autocomplete_forms', 'no_results', $field); - } else { + } + else { db_change_field('search_autocomplete_forms', 'no_results', 'no_results', array( 'description' => 'Display field when no suggestion available.', @@ -448,25 +449,25 @@ function search_autocomplete_update_7411(&$sandbox) { * Migrate no_results and all_results fields from 4.1 to 4.2 default values */ function search_autocomplete_update_7420(&$sandbox) { - - $all_fields = db_select('search_autocomplete_forms', 'sa') - ->fields('sa', array('fid', 'no_results', 'all_results')) - ->execute() - ->fetchAllAssoc('fid'); - - foreach($all_fields as $fid => $field) { - // Remove html tags in no_results label - $no_results = json_decode($field->no_results); - $no_results->label = strip_tags($no_results->label); - $all_results = json_decode($field->all_results); - $all_results->label = strip_tags($all_results->label); - - db_update('search_autocomplete_forms') - ->fields(array( - 'no_results' => json_encode($no_results), - 'all_results' => json_encode($all_results) - )) - ->condition('fid', $fid, '=') - ->execute(); - } + + $all_fields = db_select('search_autocomplete_forms', 'sa') + ->fields('sa', array('fid', 'no_results', 'all_results')) + ->execute() + ->fetchAllAssoc('fid'); + + foreach ($all_fields as $fid => $field) { + // Remove html tags in no_results label + $no_results = json_decode($field->no_results); + $no_results->label = strip_tags($no_results->label); + $all_results = json_decode($field->all_results); + $all_results->label = strip_tags($all_results->label); + + db_update('search_autocomplete_forms') + ->fields(array( + 'no_results' => json_encode($no_results), + 'all_results' => json_encode($all_results) + )) + ->condition('fid', $fid, '=') + ->execute(); + } } diff --git a/search_autocomplete.module b/search_autocomplete.module index 8d4751049de10e96c1b067ac1c437e8ec0765f09..46bbe5d6d950c85128b943c19147425a365d365e 100644 --- a/search_autocomplete.module +++ b/search_autocomplete.module @@ -33,7 +33,7 @@ function search_autocomplete_page_build() { // Get every form to autocomplete. $result = db_select('search_autocomplete_forms', 'f') ->fields('f') - ->condition('enabled', 1,'=') + ->condition('enabled', 1, '=') ->execute() ->fetchAllAssoc('fid'); // Build the setting array to transfer to JS. diff --git a/views/theme/views_search_autocomplete_style.theme.inc b/views/theme/views_search_autocomplete_style.theme.inc index 8dfb295d61513e284ab6c21fa71652639a8bcee1..07d6d30c5e284565be6088965bce68c941573720 100644 --- a/views/theme/views_search_autocomplete_style.theme.inc +++ b/views/theme/views_search_autocomplete_style.theme.inc @@ -58,7 +58,8 @@ function template_preprocess_views_search_autocomplete_style(&$vars) { } if (url_is_external($link_value) || valid_url($link_value, TRUE)) { $link = $link_value; - } else { + } + else { $link = $base_root . $link_value; } // And build the link object. @@ -125,7 +126,8 @@ function template_preprocess_views_search_autocomplete_style(&$vars) { $no_result_json = str_replace('[search-phrase]', $view->autocompletion_data['user_input'], $view->autocompletion_data['no_results']); $suggestion = json_decode($no_result_json); $group_id = 'no_results'; - } else { + } + else { // All results case $all_results_json = str_replace('[search-phrase]', $view->autocompletion_data['user_input'], $view->autocompletion_data['all_results']); $suggestion = json_decode($all_results_json);