如何使用 Drupal 使用各种节点类型制作多步骤表单
我正在创建一个非常基本的分类网站。在这个网站中,我将有各种内容类型;例如:
- 汽车(具有 cck 字段:年份、公里、颜色
- 房屋(具有 cck 字段:楼层数、花园(是/否))
所以每个“元素”都是一个内容类型。
我列出了所有我向用户显示的视图中的内容类型,然后单击链接转到“创建类型的内容类型(单击的类型)”,
但我无法摆脱“创建新类型”。创建页面顶部的“car”(反映了“drupalish”行为),
我希望以更方便的方式使用它,例如三步形式:
- 选择类别
- 选择您的选项
- 注册以发布您的新分类。
我见过 ctools;它提供了“几乎”的多步骤行为;但是我无法想象将我的所有内容类型都“硬编码”在一个模块中,
或者是否有人已经实现了这种设置 。有一种模块可以做到这一点。我想为每种类型的分类保留一个内容类型(网站管理员现在已经习惯了该界面)
。
I'm creating a very basic classifieds website. In this website i'll have various content-types; such as :
- Car (which has the cck fields : year, kilometers, color
- House (which has the cck fields : number of floors, garden (yes/no)
So each 'element' is a content-type.
I'm listing all the content-types in a view that I display to the user aand then clicking on a link goes to 'create content type of type (clicked type)'.
It's working pretty well; but i can't get rid of the 'create new car' at the top of the create page (which reflects the 'drupalish' behaviour).
I'd like to have it in a more conveniant way such as a three step form like :
- Choose category
- Choose your options
- Register to post your new classified
I've seen the ctools; which provide 'almost' the multistep behaviour; however i can't imagine having all my dozen content-types being 'hardcoded' in a single module.
I wonder if anyone has achieved this kind of setup or if there's a kind of module that can do the trick. I'd like to keep a content type for each type of classified (the webmaster is now used to the interface).
Any help, starting points would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
第一步我们必须解决一个类似的问题。为此,我们创建了基本上是对 /node/add 页面(列出所有内容类型的页面)的覆盖,您已经完成了这一点。要更改标题,最简单的方法是创建一个 yourtheme_preprocess_page() 函数,该函数会在 url 为 /node/add 或 node/*/edit 时更改标题。
但是:我强烈建议切换到对所有列表使用 1 种内容类型的系统。我们创建了一个非常相似的网站,在使用不同的内容类型之后,很明显,拥有一种带有条件显示字段的内容类型是一个更加明智的解决方案。对不同的产品类型使用类别,然后使用条件字段模块隐藏和显示正确的字段,效果会更好。
http://drupal.org/project/conditional_fields
这是在页面中设置标题的示例片段预处理函数:
设置节点/添加页面的标题:
For the first step we had to solve a simular problem. To do so we created what was basicly an override of the /node/add page (the one that lists all the content types), which you've done. To change the title the simplest is to create a yourtheme_preprocess_page() function that changes the title when the url is /node/add or node/*/edit
However: I would strongly suggest switching to a system that uses 1 content type for all listings. We created a very simular site, and after working with different content types it because clear that having 1 content type with fields that were displayed conditionally was a much more sane solution. Using categories for the different product types, and then using the Conditional Fields module to hide and show the correct fields worked much better.
http://drupal.org/project/conditional_fields
Here is and example snippet for setting the title in a page preprocess function:
Setting the title on the node/add page: