Overview

Default content gives your module and install profile a way to ship default content as well as configuration.

8.x-1.x is powered by core's serialization, rest and hal modules. The new 2.x version uses a custom normalization format that is optimized for the use case of default content.

Features

2.x

The 2.x branch is actively developed and has the following improvements over the 8.x-1.x version. The new version is however still experimental and might missing some 8.x-1.x features, specifically extensibility and integrations through hal+json normalizers.

  • A more compact YAML-based normalization format
  • Identifiers like ID, revision id, changed and revision timestamps and other fields are no longer exported
  • Built-in support for composite entities like paragraphs in a single file
  • User 0/1 are no longer exported but referenced by ID
  • Support for translations
  • Support for files (stored as files in the same folder as the normalized file enitties, filename must be unique)
  • Support for entity references in link fields
  • Improved support for path fields including the pathauto skip flag

Importing of hal_json based default content is still supported, but exporting can only be done in the new format. Support for the old format will be removed in a future version.

Important

8.x-1.x

Supports entity-references between content.
Supports files if you have File entity
Easily export your content and its dependencies to yml using drush commands.

How does it work

Enable default content first. Any module that requires default content can put YAML (hal+json for 8.x-1.x) versions of the entities inside content/{entity_type} folders.

For example see default_content_test which has

  • modules/default_content_test/content
  • modules/default_content_test/content/node
  • modules/default_content_test/content/node/imported.yml
  • modules/default_content_test/content/taxonomy_term
  • modules/default_content_test/content/taxonomy_term/tag.yml

Requirements

Core only.

Known problems

Please use the issue queue to file any issues you encounter.

Credits

Written by @larowlan in response to Snowman session by @eaton and @yoroy.

Similar projects

Looking for a D7 solution? Try here

Related modules

Supporting organizations: 
Development
Development
Development
Development
Documentation

Project information

Releases