Can someone please advise on how to programatically deal with the vocabulary/term data from OUTSIDE of bootstrap, ie not bootstrapping BD, but poking the database from custom PHP.

I am converting a D6/Ubercart where I have to do things that way due to technical architecture reasons, and wanted to find the structure in the way BD handle the Vocabs, which I see is somewhat different, without a dedicated vocabulary table.

So what I am asking for is the documentation on the vocab structuring now, in database.

Cheers!

Accepted answer

Hi @onyx.

The structure is pretty straightforward:

- Vocabulary definitions are not stored in DB as in D7 (which stored these bundle definitions in table taxonomy_vocabulary), but rather as config json files in the files/config_XXX/active folder. The name of the files is based on taxonomy.vocabulary.VOCABULARY_NAME.json. The keys are pretty much the same as the table columns in D7,"name", "machine_name", "description", "hierarchy", "language" and "weight".

- Taxonomy terms are all stored in the table taxonomy_term_data, like in D7. BUT unlike D7, the vocabulary is not stored here as a numerical ID, but as a machine name. So the columns in this table are tid (term ID), vocabulary (used to be vid, or vocabulary ID in D7), name, description, format, langcode (unique to Backdrop) and weight

- Term hierarchy is store in table taxonomy_term_hierarchy, like in D7. Just like in D7, this table uses 2 columns: tid and parent. tid is the Term ID (numerical), and parent is the tid of the parent item. 

- Additionally both D7 and Backdrop use table taxonomy_index to maintain an index of relationship between terms and the nodes that use them. It has columns nid and tid, plus created and sticky, just like D7 

 I hope this helps.

 

Comments

Hi @onyx.

The structure is pretty straightforward:

- Vocabulary definitions are not stored in DB as in D7 (which stored these bundle definitions in table taxonomy_vocabulary), but rather as config json files in the files/config_XXX/active folder. The name of the files is based on taxonomy.vocabulary.VOCABULARY_NAME.json. The keys are pretty much the same as the table columns in D7,"name", "machine_name", "description", "hierarchy", "language" and "weight".

- Taxonomy terms are all stored in the table taxonomy_term_data, like in D7. BUT unlike D7, the vocabulary is not stored here as a numerical ID, but as a machine name. So the columns in this table are tid (term ID), vocabulary (used to be vid, or vocabulary ID in D7), name, description, format, langcode (unique to Backdrop) and weight

- Term hierarchy is store in table taxonomy_term_hierarchy, like in D7. Just like in D7, this table uses 2 columns: tid and parent. tid is the Term ID (numerical), and parent is the tid of the parent item. 

- Additionally both D7 and Backdrop use table taxonomy_index to maintain an index of relationship between terms and the nodes that use them. It has columns nid and tid, plus created and sticky, just like D7 

 I hope this helps.