一种通过 drupal 中的参数限制分类法公开过滤器选项的方法
我正在构建一个产品目录,其中特定部分由带有参数(部分的分类 ID)的视图显示。
但我还需要让用户能够通过在公开的过滤器中选择另一个词汇中的术语来指定生产者,从而进一步缩小搜索范围。
我试图将选择限制为所选部分中存在的节点的术语。看起来views_selective_filter和view_hacks特别适合这一点,但看起来开箱即用,它们都没有考虑视图参数。有补救措施或解决方法吗?
I'm building a product catalog where a particular section is displayed by views with an argument, a taxonomy id of a section.
But I also need to give user the ability to further narrow down the search by specifying the producer by choosing term in another vocabulary in the exposed filter.
I'm trying to limit the selection to terms for which nodes in a chosen section exist. Looks like the views_selective_filter and view_hacks are especially for that, but looks like out of the box neither of them takes into account the view argument. Is there a remedy or workaround?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 Firebug 或 devel_themer 模块查找显示这些术语的表单的表单 ID,然后使用自定义模块中的 hook_form_alter 来拦截并修改该表单。
Use Firebug or the devel_themer module to find the form ID of the form displaying those terms, then use a hook_form_alter in a custom module to intercept, and modify that form.
最后我使用了views_taxonomy_selective_filter。我必须按照评论中所述修补视图模块,以便使其在处理参数后生成选择选项。
In the end I used views_taxonomy_selective_filter. I had to patch views module as I described in the comment in order to make it generate select options after processing arguments.