Commit 84bac3e1 authored by Dom.'s avatar Dom.

[DCE] Code review : level minor.

parent 3662a881
......@@ -31,7 +31,7 @@ function search_autocomplete_config_features_export_options() {
}
/**
* Implementation of hook_features_export [component hook]
* Implements hook_features_export().
*
* This is a component hook, rather then a module hook, therefore this is the
* callback from hook_features_api which relates to the specific component we
......@@ -58,7 +58,7 @@ function search_autocomplete_config_features_export($data, &$export, $module_nam
}
/**
* Implementation of hook_features_export_render. [component hook]
* Implements hook_features_export_render().
*
* This hook will be invoked in order to export
* Component hook. The hook should be implemented using the name ot the
......@@ -78,7 +78,8 @@ function search_autocomplete_config_features_export($data, &$export, $module_nam
* @return array
* An associative array of rendered PHP code where the key is the name of the
* hook that should wrap the PHP code. The hook should not include the name
* of the module, e.g. the key for `hook_example` should simply be `example`.
* of the module, for example the key for `hook_example` should simply be
* `example`.
*/
function search_autocomplete_config_features_export_render($module_name, $data, $export = NULL) {
$code = array();
......@@ -96,7 +97,7 @@ function search_autocomplete_config_features_export_render($module_name, $data,
}
/**
* Implements hook_features_revert(). [component_hook]
* Implements hook_features_revert().
*/
function search_autocomplete_config_features_revert($module) {
search_autocomplete_config_features_rebuild($module);
......@@ -121,13 +122,11 @@ function search_autocomplete_config_features_rebuild($module) {
}
}
/*
* Get machine name of all search data
* @return array of machine name
/**
* Get machine name of all search data.
* @return
* An associative array, or FALSE if there is no next row.
*/
function search_autocomplete_get_data() {
$codes = db_select('search_autocomplete_forms', 'sa')
->fields('sa', array())
......@@ -136,7 +135,7 @@ function search_autocomplete_get_data() {
}
/**
* Will retrieve data on basis of fid
* Will retrieve data on basis of fid.
* @param type $fid
* @return type
*/
......
......@@ -296,16 +296,6 @@ function search_autocomplete_form_configure_submit($form, &$form_state) {
$callback = $values['callback_textfield'];
// Static resource => type = 2.
$data_type = $values['suggestions'];
// if ($data_type == 'callback' && $callback != '') {
// // If path is absolute:
// if (url_is_external($callback)) {
// // If path is internal:
// if (strcmp(substr($callback, 0, strlen($base_url)), $base_url) === 0) {
// // Get it relative.
// $callback = str_replace($base_url . "/", "", $callback);
// }
// }
// }
// In the case of view, we use a custom callback to retrieve the view data.
if ($data_type == 'view') {
$callback = 'search_autocomplete/autocomplete/' . $values['fid'] . '/';
......
......@@ -321,7 +321,7 @@ function search_autocomplete_update_7407(&$sandbox) {
->condition('sa.selector', '#search-form[action="/search/node"] #edit-keys', '=')
->execute()
->fetchAssoc();
db_update('search_autocomplete_forms') // Table name no longer needs {}
db_update('search_autocomplete_forms')
->fields(array(
'data_source' => 'view',
'data_callback' => 'search_autocomplete/autocomplete/' . $fid['fid'] . '/',
......@@ -336,7 +336,7 @@ function search_autocomplete_update_7407(&$sandbox) {
->condition('sa.selector', '#search-form[action="/search/user"] #edit-keys', '=')
->execute()
->fetchAssoc();
db_update('search_autocomplete_forms') // Table name no longer needs {}
db_update('search_autocomplete_forms')
->fields(array(
'data_source' => 'view',
'data_view' => 'users_autocomplete',
......@@ -351,7 +351,7 @@ function search_autocomplete_update_7407(&$sandbox) {
->condition('sa.selector', '#edit-search-block-form--2', '=')
->execute()
->fetchAssoc();
db_update('search_autocomplete_forms') // Table name no longer needs {}
db_update('search_autocomplete_forms')
->fields(array(
'data_source' => 'view',
'data_view' => 'nodes_autocomplete',
......@@ -387,7 +387,7 @@ function search_autocomplete_update_7408(&$sandbox) {
*/
function search_autocomplete_update_7410(&$sandbox) {
if (db_field_exists('search_autocomplete_forms', 'no_results')) {
db_update('search_autocomplete_forms') // Table name no longer needs {}
db_update('search_autocomplete_forms')
->fields(array('no_results' => '-- No results found for <b>[search-phrase]</b> --'))
->execute();
}
......@@ -414,7 +414,7 @@ function search_autocomplete_update_7411(&$sandbox) {
'size' => 'big',
));
}
db_update('search_autocomplete_forms') // Table name no longer needs {}
db_update('search_autocomplete_forms')
->fields(array('no_results' => json_encode(array(
'label' => t('No results found for [search-phrase]. Click to perform full search.'),
'value' => '[search-phrase]',
......@@ -433,7 +433,7 @@ function search_autocomplete_update_7411(&$sandbox) {
);
db_add_field('search_autocomplete_forms', 'all_results', $field);
}
db_update('search_autocomplete_forms') // Table name no longer needs {}
db_update('search_autocomplete_forms')
->fields(array('all_results' => json_encode(array(
'label' => t('View all results for [search-phrase].'),
'value' => '[search-phrase]',
......
......@@ -168,7 +168,7 @@ function search_autocomplete_get_translite() {
}
/**
* Implementation of hook_features_api
* Implements hook_features_api().
*
* Here we define the components that we want to make exportable. For this
* particular module, we want to make the configurations exportable.
......
......@@ -99,7 +99,7 @@ function _search_autocomplete_render_fields($view, $row) {
* @deprecated The $option parameter in PHP 5.4.0 json_encode() deprecates this
* function.
*
* @see _search_autocomplete_json_encode
* @see _search_autocomplete_json_encode()
*/
function _search_autocomplete_encode_formatted($json, $depth = 0) {
......@@ -159,21 +159,6 @@ function _search_autocomplete_encode_formatted($json, $depth = 0) {
}
}
/**
* Helper function to finish debugging.
*
* @param mixed $var
* A variable to dump.
* @param string $location
* A location to output.
*/
function _search_autocomplete_debug_stop($var, $location) {
print("Location:$location\n");
var_dump($var);
module_Invoke_all('exit');
exit;
}
/**
* Implements hook_views_default_views().
*/
......
......@@ -7,7 +7,7 @@
/**
* Implements views_plugin_style
*/
class search_autocomplete_views_plugin_style extends views_plugin_style {
class SearchAutocompleteViewsPluginStyle extends views_plugin_style {
/**
* {@inheritdoc}
*/
......
......@@ -20,7 +20,7 @@ function search_autocomplete_views_plugins() {
'title' => t('Autocompletion JSON'),
'path' => $path . '/plugins',
'help' => t('Displays nodes in the JSON data format.'),
'handler' => 'search_autocomplete_views_plugin_style',
'handler' => 'SearchAutocompleteViewsPluginStyle',
'theme' => 'views_search_autocomplete_style',
'theme file' => 'views_search_autocomplete_style.theme.inc',
'theme path' => $path . '/theme',
......
......@@ -57,10 +57,10 @@ function template_preprocess_views_search_autocomplete_style(&$vars) {
$link_value = $matches[2];
}
if (url_is_external($link_value) || valid_url($link_value, TRUE)) {
$link = $link_value;
$link = $link_value;
}
else {
$link = $base_root . $link_value;
$link = $base_root . $link_value;
}
// And build the link object.
$object['link'] = trim($link);
......
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