search_expression_insert

Versions
7
search_expression_insert($keys, $option, $value = '')

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

▾ 1 function calls search_expression_insert()

node_search_validate in modules/node/node.module
Form API callback for the search form. Registered in node_form_alter().

Code

modules/search/search.module, line 787

<?php
function search_expression_insert($keys, $option, $value = '') {
  if (search_expression_extract($keys, $option)) {
    $keys = trim(preg_replace('/(^| )' . $option . ':[^ ]*/i', '', $keys));
  }
  if ($value != '') {
    $keys .= ' ' . $option . ':' . $value;
  }
  return $keys;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.