我正在尝试修改视图查询的where条件。到目前为止,我成功地更改了“ order by”,但是我不知道如何更改where条件。我想检查search_term,如果它是大写的,请将其转换为小写,以便查询可以找到它。在查询运行之前,我还需要用我的语言(波斯语)替换一些特殊字符。任何人都可以帮助我从哪里开始,或者使用什么钩子或views_handlers?
<?php
/**
* Implementation of hook_views_query_alter
* @param type $view
* @param type $query
*/
function nashreneydev_views_query_alter(&$view, &$query) {
//krumo($query);
//krumo($view);
if ($view->name == 'custom_search') {
$search_term = $view->exposed_raw_input['combine'];
**//$query->where[0]['conditions'][0]['field']= "?????";**
$view->query->orderby[1]['field'] = "CASE node_type WHEN 'product_display' THEN 1 ELSE 2 END";
$view->query->orderby[1]['direction'] = "ASC";
$view->query->orderby[0]['field'] = "CASE node_title WHEN '".$search_term."' THEN 1 ELSE 2 END";
$view->query->orderby[0]['direction'] = "ASC";
//krumo($view->query->orderby);
}
}
?>
现在条件如下的开发结果。:views_combine等于%s%。
CONCAT_WS('',node.title,'',field_data_body.body_value,'',field_data_field_author.field_author_target_id,'',field_data_field_data_field_translator.field_translator_target_id,'',field_data_field_data_field_book_tags.field_book_tags_tid)LIKE:views_com
@inheritdoc