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.
Is there a way to export out the vocabs into a hierarchical structure but also for each term to retain it's id? My website has a deployment structure (alpha,staging,live) and I need the terms and their id's to match on all stages especially when it concerns menus since it doesn't export/store alias for the path and only stores the drupal core system path. This in turn means News id is 29 on alpha but the id is 9 on staging so the link goes to the wrong teaser list with the wrong taxonomy.
Comments
Comment #1
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
Currently, it's possible (with last stable or dev release) only with a combination of two exports: "tid + name" and "tree". But it's simple to implement it in one export file if you tell me which csv line format you really need.
Sincerely,
Daniel Berthereau
Infodoc & Knowledge management
Comment #2
kim.le CreditAttribution: kim.le commentedI need both to be combined together where it has the tree but within the tree the id is with the name.
Comment #3
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
So an export with such a format?
Sincerely,
Daniel Berthereau
Infodoc & Knowledge management
Comment #4
kim.le CreditAttribution: kim.le commentedYes but I tried that and it didn't work. It read the tid as another term name instead.
Comment #5
Daniel_KM CreditAttribution: Daniel_KM commentedYes, of course.
I've added two new export formats for your case: "Term ids and names" and "Hierarchical tree structure with term ids and names".
I've added a new import choice too: "Term ids (tid)".
Note I choose to set the tid before the name (
tid, grand-parent name, tid, parent name...
).Also, there are some changes in the user interface of the first tab since 7.x-5.10 release.
The change has been committed and the dev tarball, already available on git here, will be available soon on main page.
Sincerely,
Daniel Berthereau
Infodoc & Knowledge management
Comment #6
kim.le CreditAttribution: kim.le commentedWhen I used "Hierarchical tree structure with term ids and names" the export looked exactly like "Term ids and names" and there wasn't any tree structure to it.
Comment #7
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
If these exports are identical, it means that your vocabulary is not a hierarchical one but a flat one.
Could you give me some lines of your exported vocabulary?
Sincerely,
Daniel Berthereau
Infodoc & Knowledge management
Comment #8
kim.le CreditAttribution: kim.le commentedThe list of terms for my vocab in the admin looks like this so shouldn't be hierarchical?
screenshot
Comment #9
Daniel_KM CreditAttribution: Daniel_KM commentedHi,
Your vocabulary is a one level hierarchical vocabulary (tree).
To get the same vocabulary, I imported your vocabulary as a structure / simple tree:
The exported vocabulary with "Term ids and names" is:
but with "Hierarchical tree structure with term ids and names", it's:
Now, you can import or update any of these terms, because they get a tid. You only need to choose to import them in the created vocabulary with the "Fields" format, the format "
tid, name
" and an input file like:These terms are updated and the tree structure is kept.
There was a little bug with this example, so you need to update the module with the last git tarball or with the dev release tomorrow.
Sincerely,
Daniel Berthereau
Infodoc & Knowledge management