You are here

function hook_sbp_query_modify in Search by Page 7

Same name and namespace in other branches
  1. 6 search_by_page.api.php \hook_sbp_query_modify()

Add conditions to the search query (required sub-module hook).

This hook allows a module to add conditions and joins (usually related to access permissions) to the query that finds the search results.

Parameters

$environment: Environment ID being queried.

$query: Query object being constructed. You can join to it using the "sp.modid" column; this will contain the ID your module returned in hook_sbp_paths(). All joins should be LEFT JOIN. You can also add tags and meta-data as necessary.

Return value

db_and() condition object to add to the query. Do not add your conditions directly, as they need to be combined with other modules' conditions.

4 functions implement hook_sbp_query_modify()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

sbp_attach_sbp_query_modify in ./sbp_attach.module
Implements Search by Page hook_sbp_query_modify().
sbp_nodes_sbp_query_modify in ./sbp_nodes.module
Implements Search by Page hook_sbp_query_modify().
sbp_paths_sbp_query_modify in ./sbp_paths.module
Implements Search by Page hook_sbp_query_modify().
sbp_users_sbp_query_modify in ./sbp_users.module
Implements Search by Page hook_sbp_query_modify().
1 invocation of hook_sbp_query_modify()
search_by_page_search_execute in ./search_by_page.module
Implements hook_search_execute().

File

./search_by_page.api.php, line 163
Search by Page module API.

Code

function hook_sbp_query_modify($environment, $query) {

  // This example gives access to every path defined by this module.
  return $db_and()
    ->condition(1);
}