This link has been bookmarked by 8 people . It was first bookmarked on 06 Jun 2008, by Myles A Braithwaite.
-
06 May 09
Glenn MThe scenario says: "And (optionally) I would like to have an 'Add New' link for authorized users to create new a new node ("type_x", "type_y" or "type_z") with "type-a" already filled in."
This section can be achieved by the prepopulate module, but it can be frustrating to figure out.
The first thing to do is figure our the querystring you need to make prepopulate work to insert the "type_a" nid into a new "type_x"
There are various combinations you should try are
Select List Option:
x = nid, example: "10"
- node/add/type_x?edit[field_type_a_parent][nid]=x
- node/add/type_x?edit[field_type_a_parent][nids]=x
w/ field in a group ({GROUP-NAME} = the group name)
- node/add/type_x?edit[group_{GROUP-NAME}][field_type_a_parent][nid]=x
- node/add/type_x?edit[group_{GROUP-NAME}][field_type_a_parent][nids]=x
Autocomplete Option:
x = Title [nid:nid], example: "Drupal Rocks! [nid:10]"
- node/add/type_x?edit[field_type_a_parent][0][node_name]=x
w/ field in a group ({GROUP-NAME} = the group name)
- node/add/type_x?edit[group_{GROUP-NAME}][field_type_a_parent][0][node_name]=x
That's the most frustrating part, but once you figure it out, you're good to go
The link will only appear when the user is looking at a specific type, and not on the "Show All" tab, and only if the user has permission to create such node types. You will need to go to your admin/user/access page and note down the name of the create permission for each your related node types. If you created them using Drupals interface, chances are the format is "create {node-type} content"
This code is PHP and should appear in PHP tags. While it can be placed where ever you like, for examples sake I suggest between the your links and your view. -
14 Jun 08
-
05 Dec 07
-
17 Apr 07
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.