1

I need to make a link to create a new node. I need this link to appear on taxonomy term pages so I was going to put it in a block. Nodes can be tagged with taxonomy terms.

How can I make it so the create node form has the term (from the page the link was on) already selected? So if you were on mysite.com/term/1 and and clicked the create node link, the node would have term 1 already selected.

Ive found this module but its in dev for D7 so there another way? http://drupal.org/project/prepopulate

Thanks

0

Yes, you need to download and enable the Prepopulate module.

The syntax you use to prepopulate taxonomy terms with D7 is (AFAIK) not documented anywhere and the syntax it is also radically different from the syntax used in D6 that is demoed in a number of screencasts of the Preopulate module. In D7 taxonomy terms are fields. If you read the source code, you'll find that you prepopulate taxonomy terms as would prepopulate other field.

I.e. if your taxonomy term field is field_tags and you want to prepopulate with the term "myterm", you use the following syntax (with clean URLs):
/node/add/article?edit[field_tags][und]=myterm.

-1

I think the Prepopulate module is in fact safe. It has a large number of sites using it and was mentioned in a mustardseed media screencast. http://drupal.org/project/prepopulate

  • Have you found documentation telling you how you do this Prepopulate? The syntax for taxonomy on the documentation page (http://www.example.com/node/add/content?edit[taxonomy][1]=2) does not to work. The syntax in the file USAGE.txt (http://www.example.com/node/add/content?edit[taxonomy][tags][1]=test) does not work. – Free Radical Oct 8 '14 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.