2

In Drupal 7, with the aid of features, we could do something like node_export, or uuid_features, etc.

I'm looking for a good way to create content / other entities using the UI and export it to code some how using Drupal 8 so that I can put into an install or update hook so that our site builders don't miss pieces of configuration.

I know we can do it programatically. And I'm all for that. I would just like an easy way to generate the Array we need to stick in our install or update hooks.

  • The Migrate UI that is for content(entities) currently does not have any UI. But I think there is a contrib module that is trying to provide something basic, don't know the name right now though. And for configuration entities there is the config module in the core that gives you the admin/config/development/configuration/single/export As to the simple array - I have a custom code for "demo" data which is simple array with some default and some random values and entity_save. – user21641 Dec 4 '15 at 17:11
  • Yeah I'm aware of Drupal's configuration management. I'm using drush cex to save a site's configuration to disk so I can commit it to git, and drush cim to import it on rebuild. As you have mentioned, yeah "Content Entities" such as nodes and taxonomy terms are what I'm looking to export and import. – General Redneck Dec 5 '15 at 18:17
3

You want the Default Content for D8 module, which provides drush commands to export and installs the content on module install. From its project page:

Default content gives your module and install profile a way to ship default content as well as configuration. Powered by core's serialization, rest and hal modules.

Features

  • Supports entity-references between content.
  • Supports files if you have File entity
  • Easily export your content and its dependencies to yml using drush commands.
  • It's not quite where I need it to be yet, though it seems like they are going the direction I was expecting. They got a TODO for a fancy UI to export content :) – General Redneck Dec 5 '15 at 18:28
0

There is a new "configuration inspector" module that shows any configuration entity in various formats, one of which ("raw") I think it's called might suit you.

0

"Default content" module has very limited usage. It doesn't check for entity uniqueness in any sensible way, as it it doesn't create correct unique URLs.

I recommend:

1) if there are few entities to export, use update hooks to manually create needed entities.

2) if there are lots of entities, export them using default content with drush dce and then create migrate + migrate_plus to create json migration where you'd skip entity ids and use uuids as object unique ids. That's a lot of work, especially if you have no experience with Drupal 8 migration, but it is the most reliable and managed way.

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.