如何在 Drupal7 中向文件字段/小部件添加附加字段
我在 Drupal 7 中有一个文件字段,我需要向其中添加其他字段。
目前唯一可用的字段是文件上传本身和描述。我想添加一个标题字段和一个带有一些硬编码选项的下拉菜单。我仍然需要文件字段的所有功能。
我该怎么做?我想我需要创建一个新的文件小部件,但不知道如何开始。
谢谢。
I have a file field in Drupal 7 that I need to add additional fields to.
Currently the only available field is the file upload itself and a description. I would like to add a title field and a dropdown with some hard-coded options. I still require all the functionality of the file field.
How can I do this? I think I need to create a new file widget but not sure how to begin.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种解决方案是使用 http://drupal.org/project/field_collection
它基本上允许您对多个字段一起构成一个“事物”。
http://drupal.org/project/media 是一种不同的方法,它可以制作图像、视频等到可以附加字段的单独实体。
One solution is to use http://drupal.org/project/field_collection
It basically allows you to group a number of fields together to a single "thing".
http://drupal.org/project/media is a different approach, which makes images, videos and so on to separate entities to which you can attach fields.
您也可以创建自己的字段,但这可能有点过头了,http:// www.agileapproach.com/blog-entry/compound-fields-drupal-7。
我个人会推荐媒体模块,遗憾的是它现在有点问题。
You could also create your own field, but it's probably overkill, http://www.agileapproach.com/blog-entry/compound-fields-drupal-7.
Personally I would recommend the Media module, sadly it's a little buggy right now.