Drupal - 在保留节点关系的节点编辑表单上创建“添加另一个”按钮 [英] Drupal - Creating 'add another' buttons on node edit forms that will retain node relationships

查看:95
本文介绍了Drupal - 在保留节点关系的节点编辑表单上创建“添加另一个”按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将图像附加到内容类型 - 市场项目 - 使用节点引用url小部件。该技术在此完整列出: http://drupal.org/node/599672

I'm attaching images to a content type - 'marketplace item' - using the node reference url widget. The technique is outlined in full here: http://drupal.org/node/599672

我的目标是为图像节点编辑表单添加一个额外的按钮,允许用户保存并添加另一个图像节点,保留此新图像的节点引用/关系节点即可。

因此按钮将是:

[保存]
[添加其他图片]
[预览]

有些模块提供添加其他功能( here 这里),但是当添加另一个节点时,它们不会保留节点关系。

There are modules that provide 'add another' functionality (here and here), but they will not retain the node relationships out of the box when another node is added.

目前,当用户单击图像节点上的保存按钮,将其重定向到引用节点,在此节点可以再次单击添加图像按钮(由节点引用小部件创建)。我看到您可以在正常提交过程之上添加一个提交按钮的功能,所以可以通过图像节点的提交按钮上的功能自动重新启动引用节点上的添加图像按钮?

At the moment, when the user clicks the 'save' button on the image node they are redirected to the referenced node, where they can click the 'Add image' button again (created by the node ref url widget). I see you can add functions to a submit button over and above the normal submission process, so is it possible to simply activate the 'Add image' button on the referenced node again automatically via a function on the image node's submit button?

ie在提交图像节点时:

i.e. on submission of the image node:


  1. 正常保存节点

  2. 转到目的地通过节点ref小部件转到原始的参考节点)

  3. 激活此节点上的添加图像按钮

(显然,我需要保留原来的保存按钮,并通过hook_form_alter创建一个新的,但为了清楚起见,我们假设这样做!)。

(Obviously I'll need to retain the original 'Save' button and create a new one via hook_form_alter, but for clarity's sake let's assume this is done!).

推荐答案

在特定的字段设置(/ admin / content / types)中,将值的数量设置为unlimited

you're using CCK, right? just set Number of values to "unlimited" in particular field settings (/admin/content/types)

请问,Slava

这篇关于Drupal - 在保留节点关系的节点编辑表单上创建“添加另一个”按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆