Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I had the issue to prepopulate an selectbox of taxonomyterms but I had only the complete taxonomyterm available (via webform). It is possible to prepopulate taxonomyterms, but you need the termid.
The patch attached enhances prepopulate to find the taxonomyid based on the term, if [term] is added to the parameter e.g.
node/add/CONTENTTYPE?edit[FIELDNAME][und][term]=MY_TAXONOMY_TERM
This is only one possible way to implement this, patch is attached
Comment | File | Size | Author |
---|---|---|---|
enhance_taxonomy_term.patch | 773 bytes | smussbach | |
Comments
Comment #1
A.Kotov CreditAttribution: A.Kotov commentedThanks a lot.
I could not prepopulate taxonomy term in dropdown menu following the manual. And this code solved problem.
Had a correct a bit, because variable names already changed.
Had this in template
After this (in prepopulate.module)
Added this
node/add/CONTENTTYPE?edit[FIELDNAME][und][term]=MY_TAXONOMY_TERM_NAME (not tid)
may be somebody could compile patch from this