diff options
author | Jennifer Hodgdon <yahgrp@poplarware.com> | 2013-06-06 11:53:24 -0700 |
---|---|---|
committer | Jennifer Hodgdon <yahgrp@poplarware.com> | 2013-06-06 11:53:24 -0700 |
commit | c38e2fe73ffa24da11cd3bd79112fcec5d787ad1 (patch) | |
tree | 507d52e23834d5f1c9f2be65098d8f183f721fbb | |
parent | 17e40d559931e2b09a47780232dd80615b13abab (diff) | |
download | brdo-c38e2fe73ffa24da11cd3bd79112fcec5d787ad1.tar.gz brdo-c38e2fe73ffa24da11cd3bd79112fcec5d787ad1.tar.bz2 |
Issue #1948564 by sarahdavies, bdgreen, joachim: Move search callback function out of hooks group and into callbacks group in search.api.php
-rw-r--r-- | modules/search/search.api.php | 75 |
1 files changed, 38 insertions, 37 deletions
diff --git a/modules/search/search.api.php b/modules/search/search.api.php index 797f7e4e8..62d53b852 100644 --- a/modules/search/search.api.php +++ b/modules/search/search.api.php @@ -47,43 +47,6 @@ function hook_search_info() { } /** - * Provide search query conditions. - * - * Callback for hook_search_info(). - * - * This callback is invoked by search_view() to get an array of additional - * search conditions to pass to search_data(). For example, a search module - * may get additional keywords, filters, or modifiers for the search from - * the query string. - * - * This example pulls additional search keywords out of the $_REQUEST variable, - * (i.e. from the query string of the request). The conditions may also be - * generated internally - for example based on a module's settings. - * - * @param $keys - * The search keywords string. - * - * @return - * An array of additional conditions, such as filters. - * - * @ingroup search - */ -function callback_search_conditions($keys) { - $conditions = array(); - - if (!empty($_REQUEST['keys'])) { - $conditions['keys'] = $_REQUEST['keys']; - } - if (!empty($_REQUEST['sample_search_keys'])) { - $conditions['sample_search_keys'] = $_REQUEST['sample_search_keys']; - } - if ($force_keys = variable_get('sample_search_force_keywords', '')) { - $conditions['sample_search_force_keywords'] = $force_keys; - } - return $conditions; -} - -/** * Define access to a custom search routine. * * This hook allows a module to define permissions for a search tab. @@ -373,3 +336,41 @@ function hook_update_index() { /** * @} End of "addtogroup hooks". */ + +/** + * Provide search query conditions. + * + * Callback for hook_search_info(). + * + * This callback is invoked by search_view() to get an array of additional + * search conditions to pass to search_data(). For example, a search module + * may get additional keywords, filters, or modifiers for the search from + * the query string. + * + * This example pulls additional search keywords out of the $_REQUEST variable, + * (i.e. from the query string of the request). The conditions may also be + * generated internally - for example based on a module's settings. + * + * @param $keys + * The search keywords string. + * + * @return + * An array of additional conditions, such as filters. + * + * @ingroup callbacks + * @ingroup search + */ +function callback_search_conditions($keys) { + $conditions = array(); + + if (!empty($_REQUEST['keys'])) { + $conditions['keys'] = $_REQUEST['keys']; + } + if (!empty($_REQUEST['sample_search_keys'])) { + $conditions['sample_search_keys'] = $_REQUEST['sample_search_keys']; + } + if ($force_keys = config('sample_search.settings')->get('force_keywords')) { + $conditions['sample_search_force_keywords'] = $force_keys; + } + return $conditions; +} |