使用 ORed 标准过滤 Drupal 视图 [英] filtering a Drupal View with ORed criteria

查看:18
本文介绍了使用 ORed 标准过滤 Drupal 视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试展示一个 Drupal 视图,该视图显示用户的电子邮件地址出现在两个 CCK 文本字段之一中的节点.不幸的是,这似乎不可能使用 Drupal 的视图模块的股票版本 - 似乎没有一种方法可以组合过滤条件(除了对它们进行 AND 运算),它们似乎也不是一种自定义方法过滤器设置的逻辑...

I'm attempting to present a Drupal View that shows nodes in which the user's e-mail address shows up in one of two CCK text fields. Unfortunately, this doesn't seem to be possible using the stock version of Drupal's Views module - there doesn't appear to be a way to combine filtering criteria (except ANDing them), nor does their appear to be a way to do the custom logic for the filter's setting...

是否有一种简单的方法可以将附加信息直接注入特定视图的 WHERE 子句?如果没有,是否可以通过其他方式完成?

Is there a simple way of directly injecting additional information into a specific View's WHERE clause? If not, can it be done in another way?

推荐答案

您可以使用 views_or 模块.它仍处于开发阶段,但看起来很有希望.

You can use the views_or module. It's still in dev but looks promising.

另一个选项是使用 hook_views_query_alter 和 $query->add_where() 你应该能够添加一个 or 子句.您还可以使用它来添加您要求的附加 WHERE 子句.

The other option is using hook_views_query_alter with $query->add_where() you should be able to add an or clause. You can also use it to add your aditional WHERE clause that you asked for.

这篇关于使用 ORed 标准过滤 Drupal 视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆