0
votes

Imagine the following content types:

Content Type A - Title - Field with a link "Add content of type B"

Content Type B - Title - Node Reference

If one adds content of the content type A and views this node, there shall be a Link/what ever which says "Add content of type B". When clicking this link (/node/add/b), there shall be a direct reference to the previous node of type A. For instance:

User adds new content (type A) titled "Awesome content" with url node/10. Some other user views this node, sees the link "add content of type b" and opens node/add/b. In this node form, there is the field "Node reference" and shall automatically preselected node/20 because this is the node the last user came from. Is this possible?

3

3 Answers

1
votes

I haven't seen a module that does this.

But you could do it by having a link on node A, but instead of it being 'node/add/b', you could make the link 'node/add/b/[node A id]'.

Then on node b have a node reference field and set the default of this field with a form_alter and get node A's id with arg(3) in the form_alter.

0
votes

I think this new module might help you, Inline Entity Form this gives you the ability to edit ContentTypeA node which holds an inline field that is reprsenting ContentTypeB node. all this from the same page. add to this, from that field you can add multiple fields and nodes I think. there is youtube video that explain it

0
votes

Nodereference URL widget does this magically awesome.