Drupal - Creating 'add another' buttons on node edit forms that will retain node relationships

流过昼夜 提交于 2020-01-16 19:25:06

问题


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

My goal is to add an extra button to the image node edit form that will allow users to save and add another image node, retaining the node references/relationships for this new image node.

Therefore the buttons will be:

[Save] [Add another image] [Preview]

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?

i.e. on submission of the image node:

  1. Save the node as normal
  2. Go to destination (set via the node ref widget to go to the original, referenced node)
  3. Activate the 'Add image' button on this node

(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!).


回答1:


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

Regards, Slava



来源:https://stackoverflow.com/questions/6347580/drupal-creating-add-another-buttons-on-node-edit-forms-that-will-retain-node

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!