I did a drush config-export staging
on a local version of my site then a drush config-import staging
on the server. It imported all the taxonomy vocabulary but no terms. I also tried it via the UI (Configuration->Development->Configuration Synchronization). Is this a bug or just the unfinished nature of Drupal 8?
2 Answers
Configuration management is exporting exactly what it was designed to do: Export the configuration settings. The actual taxonomy terms themselves are sitting in the taxonomy_term_field_data
table in the database.
-
1I see. So terms are not considered part of the site configuration? Commented Aug 27, 2015 at 16:38
-
4Not at the moment, but if you created your own config module and stored them in the configuration for it, then they would be part of the configuration settings for the new module. I did that when I first created the advanced tour module so that things other than text could be used, like Intermedia video. Commented Aug 27, 2015 at 17:02
-
4Terms are content entities because they are fieldable whereas vocabularies are not so they are configuration entities, hence only they are exportable.– user21641Commented Aug 27, 2015 at 18:37
-
4If someone's looking for an example module to help with turning terms into configuration, I think Config Menu Link might be a good one.– colanCommented Dec 23, 2015 at 19:23
-
1@CraigBowman — Any tips on how to "store [terms] in the configuration for [your own config module]"? I'm creating my own custom module and exporting a taxonomy vocabulary; would also like its terms exported along with it. I have the ability to edit the
taxonomy.vocabulary.*.yml
file (Drupal 8) by hand if need be. Please add this to your answer if you would be so kind. Thanks!– chharveyCommented May 8, 2017 at 17:22
This is by design as taxonomy terms is the content, not configuration.
Features deals exclusively with configuration and so won't include support for content entities such as taxonomy terms.
Source: Exporting of Taxonomy terms.
However you can use other modules which may work with content such as Default Content module which supports taxonomy terms. Or check Deploy module for content staging.
For example check out this patch for Default Content module: Drush comand to export all items, once applied, you can export all terms from the specific vocabulary using drush
, e.g.
drush dcer taxonomy_term vid my_vocabulary --folder=dest/
See also: How do I export my site structure?