Commit 3662a881 authored by Dom.'s avatar Dom.

[DCE] Code review : level normal.

parent 82f56978
......@@ -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;
}
......
<?php
/**
* Implementation of hook_features_export_options. [component_hook]
* @file
* Search Autocomplete
* Add support for CTools and feature import/export.
*
* Sponsored by:
* www.axiomcafe.fr
*/
/**
* Implements hook_features_export_options().
*
* This hook will alert features of which specific items of this component may
* be exported. For instances, in this case, we want to make available all the
......@@ -114,7 +123,7 @@ function search_autocomplete_config_features_rebuild($module) {
/*
* Get machine name of all search data
* @return array of machine name
* @return array of machine name
* @return
* An associative array, or FALSE if there is no next row.
*/
......
......@@ -316,7 +316,7 @@ function search_autocomplete_form_configure_submit($form, &$form_state) {
'value' => $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',
),
);
......
......@@ -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();
}
}
......@@ -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.
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment