I don't create this issue as a bug report, it's probably more of a task or feature request that needs to follow the behavior described below. This isn't something unique to the Currency Taxonomy module it's more of a general problem when providing content through hook_install. This also has been described somewhere else before, maybe in core, but I can't find it right now.
When you install Currency Taxonomy from the UI or from Drush the terms get created as intended. BUT when Currency Taxonomy gets installed from configuration import drush -y cim the terms don't get created, only the vocabulary gets created.
As a workaround it probably would be a good idea to at least provide a simple form under /admin/config/content/currency_taxonomy that has a submit button to manually trigger _currency_taxonomy_add_terms() and maybe also checks if terms with the same name inside the currencies vocabulary exist yet.
Steps to reproduce
- Vanilla Drupal standard installation
drush -y site:install --site-name="Hello World" --account-name=admin --account-pass=admin - Install Currency Taxonomy -> Terms are there
- Export config
drush -y cex - Save the site UUID somewhere
drush -y cget system.site uuid - Drop database, reinstall Vanilla Drupal standard installation (step 1.)
- Set site UUID from step 3.
drush -y cset system.site uuid YOUR-SITE-UUID - (Fix shortcut set
drush -y edel shortcut_set) - Import config
drush -y cim-> vocabulary is there, terms are not there
Comments
Comment #2
norman.lolAh no, switching this to bug report. There also are fields being created upon installation. But programmatically. While they probably should rather be create from Yamls inside the config/install folder.
Enabling the module from configuration without having these fields exported earlier then simply deletes these fields for not being in the currently imported config. This then prevents the terms from being created due to missing fields.
Comment #3
norman.lolNah, the missing fields still don't explain it. Even with the fields exported as config, the Terms don't get created upon module installation on configuration import. But maybe putting them as Yamls in config/install would fix it.
Comment #4
norman.lolComment #5
binnythomas commentedI am facing this issue as well. The taxonomy terms get created when module is enabled from UI but not on config import. Manually enabling and disabling the module generates the taxonomy terms but leads to errors on the next import causing it to fail.
Comment #6
binnythomas commentedI am thinking if terms are added via hook update instead of install it might work.
Comment #7
abhaysaraf commentedI think, here a patch is required that checks if vocabulary and respective fields already exists.
Line 956, function _currency_taxonomy_create_taxonomy() in currency_taxonomy/currency_taxonomy.module file.
As 'drush cex' exports the vocabulary and module install tries all again.
Comment #8
astonvictor commentedComment #9
astonvictor commentedIt is fixed in the issue - Moved creating vocabulary from the install hook.
+ anyway you can use
drush php-eval 'currency_taxonomy_add_terms();'command to force create all terms.