我创建了一个基本的 Drupal 表单。现在我想,例如,如果一名工程师学生选择接受工业科学培训,那么所有书名都必须出现。但是,如果经济学学生选择培训业务,那么所有书名都必须只出现业务,而不是工业科学或其他的标题。
我认为过滤器可以解决我的问题。有人有教程的链接吗?
提前致谢!
I have created a basic Drupal form. Now i want, if for example a ingenieur student choose for a training industrial sciences than must al titles of books appear. But, if a economics student choose for a training business than must al titles of books appear only the business and not the titles of industrial sciences or others.
I think a filter would fix my problem. Have someone a link to a tutorial?
Thanks in advance!
发布评论
评论(2)
在不了解具体细节的情况下,包罗万象的解决方案是实现 hook_form_alter 对于该特定表单,这样您很可能只需根据用户拥有的角色/用户所属的组来切换加载选项的词汇表/列表的 ID ,这是示例。
但是,如果我们更多地了解您的具体情况,可能会存在更有针对性的解决方案。
Without knowing the specifics, the catch-all solution would be to implement hook_form_alter for that specific form, that way you would most likely just switch the ID of the vocabulary/list the options are loaded from depending on the roles the user has/group the user belongs to, here is an example.
However if we know more about your specifics, there may be more targeted solutions existing.
您可以尝试分层选择列表http://drupal.org/project/hierarchical_select
You can try heirarchical select list http://drupal.org/project/hierarchical_select