如何使用 CCK API 创建节点引用字段?
我们目前正在构建一个自动创建内容类型的模块,该模块允许在任何 Drupal 平台上快速安装内容类型,而无需手动创建数百个内容类型和字段。在我们之前的版本中,我们手动创建节点引用字段,效果很好。现在,我们想使用我们的模块创建它,因为我们必须在已经投入生产的数十个平台上添加这些内容类型和字段;手动创建字段将是一个疯狂的想法。我们必须使用节点参考 API 吗?我们即将能够创建它,但是在 VIEWS 中,节点引用字段不会出现。看来我们错过了什么。我们试图签入 CCK php 文件以了解 CCK API 的使用方式(如果我们可以在表单中创建它,那么我们当然可以对其进行编码)。有什么想法吗?我们应该使用哪些API和函数?我想知道如何做到这一点的正确方法。
We're currently building a module which automatically create content type, which allow to quickly install content types on any Drupal platform, without having to manually create hundred of content types and fields. In our previous versions, we were manually creating node reference fields and it works great. Now, we want to create it using our module since we have to add those content types and fields on dozen of platforms already under production; creating manually the fields would be a crazy idea. Do we have to use the node reference API? We are close to being able create it but, in VIEWS, the node reference fields do not appears. It seems we missed something. We're trying to check in the CCK php files to understand how the CCK API is used (if we can create it in a form then, for sure, we can code it). Any idea? Which API and functions should we use? I would like to know the proper method on how to do this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该使用功能而不是编写代码来创建内容类型。建立一个包含您需要的所有类型的网站,将它们导出到某个功能,将其与您的模块集成,非常简单!
You should use features rather than write code to create content types. Take a site w/ all the types you need, export them to a feature, integrate that with your module, easy as pie!