search_query_insert

5 search.module search_query_insert($keys, $option, $value = '')
6 search.module search_query_insert($keys, $option, $value = '')

Return a query with the given module-specific search option inserted in. e.g. 'type:book'.

3 calls to search_query_insert()

File

modules/search/search.module, line 680
Enables site-wide keyword searching.

Code

function search_query_insert($keys, $option, $value = '') {
  if (search_query_extract($keys, $option)) {
    $keys = trim(preg_replace('/(^| )' . $option . ':[^ ]*/i', '', $keys));
  }
  if ($value != '') {
    $keys .= ' ' . $option . ':' . $value;
  }
  return $keys;
}

Comments

Drupal 7

In Drupal 7, the equivalent function to this is http://api.drupal.org/api/function/search_expression_insert/7

Login or register to post comments