[Default Content][1] allows you to export content along with site configuration information. It does so by leveraging core's serialization and hal modules. It supports entity-references between content as well as files if you have File entity. Content export works with a set of drush commands (more on those below). Content import happens automatically as part of site installation. The import process scans all modules and imports any content found that is located in the expected file path and using the expected .json file structure. (See detailed information below)
### 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
### Additional Information
* For a full description of the module, visit the project page:
https://www.drupal.org/project/default_content
* To submit bug reports and feature suggestions, or to track changes:
The module has no menu or modifiable settings. There is no configuration. When the default_content module is enabled, the core HAL and Serialization modules must also be enabled. If they are currently disabled, activating default_content will give you the option to enable them.
## Usage
For any module that requires default content, the export process is as follows:
1) Generate a hal+json file for each entity to be exported using the drush commands described below.
2) The entity .json files must be stored in module subdirectories using the following structure: `content/{entity type}/{filename}`, where `{entity type}` will be one of node, taxonomy_term, etc. Filename should be `{entity ID}.json`. For example, a Basic Page with the node ID of 23 would be stored in:
3) Once your custom module is enabled, the entities you exported will be imported to the new environment during new site installation.
### Note
At the moment these files need to be hand-created or exported using the Rest, Hal and Serialization modules.
Note that the default functionality of the Hal module is to make all links point to the origin site's FDQN.
...
...
@@ -26,9 +75,93 @@ Note that imported.json contains a node with a term reference field that include
The Gliph library (in 8.x core) is used to resolve the dependency graph, so in this case the term is imported first so that the reference to it is created in the node.
To do
=====
### Drush Commands
#### Exports a single entity
##### default-content-export
Arguments:
-**entity_type:** The entity type to export.
-**entity_id:** The ID of the entity to export.
options:
-**file:** Write out the exported content to a file instead of stdout
aliases: dce
-**required-arguments:** 2
Example:
```
$ drush dce node 123 my_default_content_module
```
Change the entity type, as we have them in the system.