Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
309
Merge Requests
309
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
75c40754
Commit
75c40754
authored
May 08, 2013
by
jhodgdon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1948564
by aitiba: Use new standard to document search conditions callback
parent
d9ac5b6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
core/modules/search/search.api.php
core/modules/search/search.api.php
+16
-9
core/modules/search/tests/modules/search_extra_type/search_extra_type.module
.../tests/modules/search_extra_type/search_extra_type.module
+2
-0
No files found.
core/modules/search/search.api.php
View file @
75c40754
...
...
@@ -34,11 +34,7 @@
* the module name if not given.
* - path: Path component after 'search/' for searching with this module.
* Defaults to the module name if not given.
* - conditions_callback: Name of a callback function that 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. Sample
* callback function: sample_search_conditions_callback().
* - conditions_callback: An implementation of callback_search_conditions().
*
* @ingroup search
*/
...
...
@@ -46,22 +42,33 @@ function hook_search_info() {
return
array
(
'title'
=>
'Content'
,
'path'
=>
'node'
,
'conditions_callback'
=>
'
sample_search_conditions_callback
'
,
'conditions_callback'
=>
'
callback_search_conditions
'
,
);
}
/**
* An example conditions callback function for search.
* 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.
*
* @see hook_search_info()
* @param $keys
* The search keywords string.
*
* @return
* An array of additional conditions, such as filters.
*
* @ingroup search
*/
function
sample_search_conditions_callback
(
$keys
)
{
function
callback_search_conditions
(
$keys
)
{
$conditions
=
array
();
if
(
!
empty
(
$_REQUEST
[
'keys'
]))
{
...
...
core/modules/search/tests/modules/search_extra_type/search_extra_type.module
View file @
75c40754
...
...
@@ -17,6 +17,8 @@ function search_extra_type_search_info() {
}
/**
* Implements callback_search_conditions().
*
* Tests the conditions callback for hook_search_info().
*/
function
search_extra_type_conditions
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment