I am new to configuration, and trying to understand how it works. I am working locally on a custom entity (a basic one created using drupal generate:entity:content), and then I used the UI to add bundles and fields to it.
I am trying to export this entity, all of it's bundles, and all of the fields for each bundle, so that the other developers, themers, and the other environments can all have access to these. We used to use features to export all these out, but wanting to move to the 'standard' way of doing things, decided to switch to configuration and having a hard time figuring out how to use it.
Once I got everything I wanted built, I use 'drush config-export', but when I try to use drush config-import on any site other than the original environment/site I spun up, I get a 'not the original UUID for this configuration', leading me to not be able to import anything.
I also tried placing the specific config files inside of the 'config/install' directory inside of my module, but for some reason nothing is read and nothing is imported/created inside of the environment I am trying to get it on.
Can somebody please help me understand what I should be doing?
Comments
If you import a single
If you import a single configuration, you may remove UUID, for instance like this:
https://drupal.stackexchange.com/a/295321
But if if you import a full configuration, then sites UUIDs must match (see 'Managing your site's configuration').
If the UUIDs are different you can find recipes here 'How can I import the configuration on a different site?'.
Also, you may look at the 'Configuration development' module.
@wombatbuddy I have used all
@wombatbuddy I have used all of those resources and methods, and am still not able to get configuration to export/import correctly.
When I did the export, I used the UI via configuration sync/export/single item on all of the stuff introduced via the module I made. I then manually removed the UUID property from all of the .yml files and installed them into the my_module/config/install directory. None of them are being read.
To test, I even created a new taxonomy vocabulary, exported it out into config, then created a brand new module with just that taxonomy yml file in it. When I imported it into a new drupal install, the taxonomy vocabulary was not available.
For some reason or another, the drupal instance is not reading the files in config/install like it should.
I should add that I created the base entity and schema using 'drupal:generate:entity', then created the bundles inside that entity (and fields), via the ui. When I export out the entity type and fields, they don't get imported into a new, clean install of drupal, even with the UUID property ommitted.
To test, I even created a new
What is the module name, the module path, and the full path to one of the config files you installed? Also, please include the contents of that file.
You will also need your module to depend on the taxonomy module, to ensure it is installed before your module, or else your config will not be imported.
Contact me to contract me for D7 -> D10/11 migrations.
@wombatbuddy I have used all
@wombatbuddy I have used all of those resources and methods, and am still not able to get configuration to export/import correctly.
When I did the export, I used the UI via configuration sync/export/single item on all of the stuff introduced via the module I made. I then manually removed the UUID property from all of the .yml files and installed them into the my_module/config/install directory. None of them are being read.
To test, I even created a new taxonomy vocabulary, exported it out into config, then created a brand new module with just that taxonomy yml file in it. When I imported it into a new drupal install, the taxonomy vocabulary was not available.
For some reason or another, the drupal instance is not reading the files in config/install like it should.
I should add that I created the base entity and schema using 'drupal:generate:entity', then created the bundles inside that entity (and fields), via the ui. When I export out the entity type and fields, they don't get imported into a new, clean install of drupal, even with the UUID property ommitted.
Thanks for your reply.
Thanks for your reply.
To answer, the full machine name of the module is:
`my_test_taxonomy_module`
And it's located in `docroot/modules/custom`
I then have a file I exported from the first install called.
taxonomy.vocabulary.test.yml located inside of
`my_test_taxonomy_module/config/install`
And the other points I
And the other points I brought up?
Contact me to contract me for D7 -> D10/11 migrations.
The module info file is a
The module info file is a standard basic info file you provide with standard modules, nothing special to it.
As far as the yml file, I'll have to include it when I am back at the computer, but with the exception of the first line with the uuid in it being removed, it's pulled directly from the UIs config exporter.
my_test_taxonomy_module.info
my_test_taxonomy_module.info.yml located in root/modules/custom/my_test_taxonomy_module
name: 'my_test_taxonomy_module'type: module
description: 'My Awesome Module'
core: 8.x
package: 'Custom'
dependencies:
- taxonomy
Filename taxonomy.vocabulary.test.yml located in root/modules/custom/my_test_taxonomy_module/config/install
langcode: enstatus: true
dependencies: { }
name: 'Test'
vid: test
description: ''
weight: 0
That all looks right to me.
That all looks right to me. And to be clear, those files existed when the module was installed, right? They weren't added after installation?
Contact me to contract me for D7 -> D10/11 migrations.
Correct. They existed before
Correct. They existed before it was installed.
It seems to be an issue with running configuration on module installation.
Unfortunately, I've got
Unfortunately, I've got nothing for you. I've done the exact same process before, and it worked.
Are you sure you got all the configuration files, and didn't miss any?
Contact me to contract me for D7 -> D10/11 migrations.
Would there be a way I could
Would there be a way I could zip up the module and send it to you so you can test it locally and see if it's just something on my end?
You'd be better off putting
You'd be better off putting it up on a code pen somewhere and linking. That way others can chime in, not just me. I'm already mostly out of ideas.
Contact me to contract me for D7 -> D10/11 migrations.
I'll figure something out.
I'll figure something out. There a huge list of config files in the module so I may have to Google drive it.
I'd export config, add all
I'd export config, add all config file to git, then create the taxonomy. Re-export the config, and do a git diff to check which config files were created for the taxonomy. That way you can check if you got them all.
Contact me to contract me for D7 -> D10/11 migrations.
So not sure why or what
So not sure why or what happened, but it suddenly started installing the configuration on module install.
The problem now, is that I created the bundles using the UI, and it doesn't appear to have exported bundle and field information correctly in configuration, as when I go to attempt to create a new piece of content for one of the created bundles, the fields aren't showing up for it. (Even though, if I go to Item Types > Bundle Name > Manage Fields, they all show up on that page), but when I go to the actual add page, there's just a 'Save' button.
Sounds like a combination of
Sounds like a combination of not setting the field to display on the 'manage form' tab, and/or that you haven't properly copied over all the .yml files that are necessary.
Contact me to contract me for D7 -> D10/11 migrations.
You my friend, are a genius.
You my friend, are a genius. I on the other hand, am an idiot. That's exactly what the issue was. All of the form fields appear as 'disabled' by default. Thank you!
No problem! Glad you got it
No problem! Glad you got it figured out.
Contact me to contract me for D7 -> D10/11 migrations.