简体   繁体   English

如何在Drupal的添加内容窗口中过滤字段?

[英]How to filter a field in the add content window in Drupal?

I am very new to Drupal so I'm sorry for my lack of familiarity with Drupal terminology. 我对Drupal非常陌生,因此对我对Drupal术语缺乏了解感到抱歉。

I have a content type with multiple fields (A, B, C, etc..). 我有一个具有多个字段(A,B,C等)的内容类型。 Each field is a selectable vocabulary list. 每个字段都是一个可选的词汇表。 I would like the user to select any terms in A and B fields. 我希望用户在A和B字段中选择任何术语。 But I want only relevant terms to display in the C field (depending on A and B selections). 但是我只希望在C字段中显示相关术语(取决于A和B选择)。 In this way, A and B are independent fields and terms that appear in C are dependent. 这样,A和B是独立的字段,并且出现在C中的项是从属的。

Example: 例:

Content type: Food dish at a restaurant 内容类型:餐厅的菜

Field A: Appears on Menu type (Breakfast menu, lunch menu, dinner menu, wine list,etc.) 栏位A:显示在菜单类型上(早餐菜单,午餐菜单,晚餐菜单,酒单等)

Field C: Appear in Menu section (Appetizers, Entrees, Deserts, etc.) 字段C:显示在“菜单”部分(开胃菜,主菜,沙漠等)

If the user selects "Breakfast Menu" for field A, it wouldn't make much sense to allow the user to select "Desert" for field C. But selecting "Appetizers" or "Entrees" would be fine. 如果用户为字段A选择“早餐菜单”,则不允许用户为字段C选择“沙漠”。但是选择“开胃菜”或“主菜”就可以了。 I want to filter the selectable terms in field C depending on which options are selected for field A. 我想根据为字段A选择了哪些选项来过滤字段C中的可选术语。

Thank you for helping me out! 谢谢您的帮助! Really :) 真的:)

A quick solution is to use Simple hierarchical select or Hierarchical Select . 一种快速的解决方案是使用“ 简单层次选择”或“ 层次选择” But in this case, you will have to combine all your terms inside one taxonomy vocabulary taking advantage of taxonomy's parent-child relationship. 但是在这种情况下,您将必须利用分类法的父子关系将所有术语合并到一个分类法词汇表中。 And Hierarchical Select will take care of the rest. 其余部分将由Hierarchical Select负责。

Hierarchical Select Documentation . 分层选择文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM