2

I'm used to leverage Bundle Copy to import/export content types with Drupal 7. One of my expectations with Drupal 8 is that I could theoretically achieve this with CMI. On the Bundle Copy project page it's also mentioned that "Bundle Copy is in Drupal 8 Core CMI!" so it all looks promising.

However, due to UUIDs and CMI's focus being on supporting content staging across multiple instances of a same site, it doesn't seem that obvious to create a generic content type that you would export on N number of sites.

For instance, take a photo gallery content type. Once you've created it and that you're happy with everything, you probably don't want to go through the same hassle again and would likely prefer to simply import the YML files onto the active configuration dir via CMI's single import tab (by manually copying the content of your YML files) or via the Synchronize tab (by making YML files available under the staging dir).

I thus wonder if a) I've missed something and b) if yes, what's your recipe for portable content types, if any?

2
  • 1
    Suspiciously smells like migration to me at least but we have not yet written Drupal 8 sources. – user49 Feb 7 '14 at 20:09
  • I didn't even think of migrations in first place but I very much look forward this being an option at some point for sure. Thanks! – anavarre Feb 8 '14 at 9:01
2

It should be possible to take most relevant config files (content type, fields, displays, ...), create a module, put them in the config folder of it and install that module on any site you want. Or the same with an install profile, I made some relatively successful* tests there by throwing all config of an actual site into an install profile and was able to install it.

You can also manually edit them, as long as you're not doing in the active storage.

Problematic are for example config files that contain a mix of things. Translation settings for example, which are stored in a single yml file for all entities and bundles, or rest.module settings, all enabled resources are also in a single file. So you would have to write code that manually updates that configuration in hook_install().

* Relatively successful, which means I had some troubles with config that referenced content (custom blocks, default images of image fields) but I think that can be sorted out.

2
  • Okay, IIUC there's no site builder's feature yet available to achieve this. If it doesn't live in Core when CMI is completed, it would probably be a good contrib module. For now I'll go with your suggestion to create a module and get config files imported on module enablement. Thanks! – anavarre Feb 8 '14 at 8:59
  • yes, I assume that features or a successor will somehow re-invent itself on top of CMI. We'll see. – Berdir Feb 8 '14 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.