创建表单提交时如何自动设置 CCK 节点引用字段的值
我有一个内容类型 (A),它引用不同内容类型 (B) 的单个节点。可以使用创建此新节点 (A) 的用户的信息以编程方式确定引用的节点 (B)...每个用户只能创建引用内容类型 (B) 的单个节点,因此该单个节点将始终是从用户创建的内容类型 B 的节点引用。
因为引用的节点总是已知的,所以我不希望用户必须输入引用值,我想在幕后为他们设置它。我发现了许多关于执行此操作的线程,但似乎没有一个是明确的或实际上对我有用。
任何帮助将不胜感激。
注:Drupal 6
I have a content type (A) that references a single node of a different content type (B). The node referenced (B) can be programmatically determined using the information for the user creating this new node (A)... Each user can only create a single node of the referenced content type (B), so this single node will always be referenced from nodes of content type B that the user creates.
Because the referenced node is always known, I don't want the user to have to enter the reference value, I want to set it for them behind the scenes. I've found a number of threads about doing this, but none seem to be clear or actually work for me.
Any help would be greatly appreciated.
Note: Drupal 6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试:
这应该将值添加到节点并在创建后保存它。
http://api.drupal.org/api/function/hook_nodeapi
注意:您将需要创建一个模块来促进这一点。不过,您也可以尝试规则模块,但我不确定它是否会在没有自定义规则的情况下执行您所要求的操作。但我知道上面的方法会起作用。
You can try:
This should add the value to the node and save it after it has been created.
http://api.drupal.org/api/function/hook_nodeapi
Note: You will need to create a module to facilitate this. You can also try the Rules module, though, I am not sure it will do what you ask without a custom rule. But I know the above method will work.
无需任何编程 - 使用“规则”模块,事件 - 节点更新,操作 - 将字段设置为某个值。
Without any programming - use "Rules" modules, event - node update, action - set field to some value.