在视图7.x-3.5中,使用UI可能无法实现.
假设您的模块名称是 my_module
将以下内容添加到my_module.module文件中
<?php
function my_moudle_views_api() {
return array(
'api' => 3,
);
}
?>
Run Code Online (Sandbox Code Playgroud)
和
以下是my_module.views.inc
<?php
function eb_mine_views_query_alter(&$view, &$query) {
if ($view->name == 'statuser') {
dsm($query, 'before');
$query->where[0]['type'] = 'OR';
dsm($query, 'after');
}
}
?>
Run Code Online (Sandbox Code Playgroud)
资料来源:http://drupal.org/node/1451218#comment-6136692
而在早期版本的视图中,上下文过滤器的AND/OR选项将由视图中第一组静态过滤器的AND/OR选项决定.
Grouping of contextual filters
Even though contextual filters do not appear in the "and/or" user interface for sorting and grouping regular filters, contextual filters are always added to the first group of filters. Thus the order of the groups can cause the contextual filter to have entirely different effects on the results of a view that has contextual filters. Even though differences might not be apparent through the user interface.
Multiple contextual filters are therefore always in the same "and/or" group of filters, and can not be placed in different groups. There is an effort to add this feature.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5807 次 |
最近记录: |