CCK为输入形式,但不是节点结构

发布于 2024-09-13 12:15:32 字数 268 浏览 7 评论 0原文

我有一个用户创建的内容类型(Witl)。在创建表单上,用户从视图 (VOut) 生成的节点列表中选择一个选项。现在我将该选项存储为 Witl 上的节点引用。

我需要重构周围的事物,以便该节点引用不存储在 Witl 本身上,而是最终作为节点引用存储在另一个节点上。但是,用户只能创建 Witl 内容类型。这意味着我必须找到一种方法来向 Witl 上的用户呈现该视图(选择列表),但根本不将其保存在 Withl 上。能做到吗?有没有办法仅使用一种内容类型创建表单作为呈现视图的方式,而不在此内容类型上存储数据?

I have a content type (Witl) that the user creates. On the creation form, the user selects an option out of a list of nodes that's generated from a view (VOut). Right now I store that option as a node reference on Witl.

I need to restructure things around, so that this node reference isn't stored on Witl itself, instead eventually stored as a node reference on another node. However the user can only create Witl content types. This means that I have to figure out a way to present that view (the selection list) to the user on Witl, yet not save it on Withl at all. Can it be done? Is there a way to use one content type creation form only as a way to present the view, yet not store the data on this content type?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

假情假意假温柔 2024-09-20 12:15:32

是的,这是可以做到的。

实现 hook_form_alter() 将字段动态添加到内容创建表单,而不是在内容类型 Witl 上创建字段。然后,在提交表单后,实现 hook_nodeapi() 将此值保存在某处。

不过,我不确定这是否是最好的方法。

Yes, this can be done.

Instead of creating the field on the content type Witl, implement hook_form_alter() to add the field dynamically to the content creation form. Then, implement hook_nodeapi() to save this value somewhere, after the form is submitted.

I'm not sure if it's the best way, though.

何以心动 2024-09-20 12:15:32

引用不存储在 Witl 节点中真的很重要吗?有几个模块试图解决在节点之间创建和显示双向关系的问题,但据我所知,它们都没有在引用的节点中保存引用。

假设你有两个节点,节点A(类型:Witl)和节点B(类型:other),你需要对B到A的引用做一些事情。这就是你的情况,对吗?

相应节点引用模块采用“简单”方法,将 A 中的引用复制到 B 中并复制它作为 B 到 A 中的引用。

其他模块,例如 节点关系反向节点参考认为数据库不应包含重复数据,并在查看节点 B 时尝试解析 A 到 B 中的关系。

如果确实必须的是,当添加到 A 中时,引用存储在 B 中,那么就我个人而言,我会采用相应节点引用中的代码作为自定义模块的基础。

Is it really important that the reference is not stored in the Witl node? There are several modules that try to address the problem of creating and displaying bi-directional relationships between nodes, but as far as I know, none of them save the reference only in the referenced node.

Suppose you have two nodes, node A (type: Witl) and node B (type: other), and you need to do something with the reference from B to A. This is your situation, right?

The Corresponding Node References module takes the 'easy' approach and will take the reference in A to B and duplicate it as a reference in B to A.

Other modules, like Node Relationships and Reverse Node Reference argue that databases should not contain duplicate data and try to resolve the relationship in A to B when looking at node B.

If it is indeed a must that the reference, when added in A, is only stored in B, then personally, I would take the code from Corresponding Node References as a basis for a custom module.

久光 2024-09-20 12:15:32

我相信可以使用以下模块

http://drupal.org/project/nodereference_url

来做到这一点以下是该模块的教程:

http://mustardseedmedia.com/podcast/episode37

本教程可能这会让您有点困惑,所以我建议您首先阅读该模块的文档。

基本上,这个模块的作用是允许您将 VOut 链接到 Witl。现在正如您所解释的,Witl 链接到 VOut。但是使用nodereference URL 模块后,您将能够在VOut 中拥有一个链接回Witl 的节点引用字段。

I believe its possible to do this using the following module

http://drupal.org/project/nodereference_url

Here is a tutorial of the module:

http://mustardseedmedia.com/podcast/episode37

This tutorial might confuse you a bit so I would recommend you read the documentation for the module first.

Basically, what this module will do is allow you to link a VOut to a Witl. Right now as you explained, a Witl links to a VOut. But after using the nodereference URL module you will be able to have a node reference field within VOut that links back to a Witl.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文