summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique CLAUSE2015-02-05 15:59:44 (GMT)
committerDominique CLAUSE2015-02-05 15:59:44 (GMT)
commit3662a8816579491afa20285a8996454a8845b17a (patch)
treefe25c82c2a95e05c17f2fd411ae52ebf102a42fb
parent82f5697821f182803bae08ed17be6f6ff0faba93 (diff)
[DCE] Code review : level normal.
-rw-r--r--search_autocomplete.autocomplete.inc10
-rw-r--r--search_autocomplete.features.inc13
-rw-r--r--search_autocomplete.form.configure.inc4
-rw-r--r--search_autocomplete.install57
-rw-r--r--search_autocomplete.module2
-rw-r--r--views/theme/views_search_autocomplete_style.theme.inc6
6 files changed, 52 insertions, 40 deletions
diff --git a/search_autocomplete.autocomplete.inc b/search_autocomplete.autocomplete.inc
index a2b7686..c374d6c 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 dd56bda..018707c 100644
--- a/search_autocomplete.features.inc
+++ b/search_autocomplete.features.inc
@@ -1,7 +1,16 @@
<?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.
*/
diff --git a/search_autocomplete.form.configure.inc b/search_autocomplete.form.configure.inc
index 1a69b40..8e334f0 100644
--- a/search_autocomplete.form.configure.inc
+++ b/search_autocomplete.form.configure.inc
@@ -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',
),
);
diff --git a/search_autocomplete.install b/search_autocomplete.install
index 2acb2f4..8dc005a 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 8d47510..46bbe5d 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 8dfb295..07d6d30 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);