User login

Drupal 8 default content the Agaric way

For the moment, we're following the crowd and using the Default content module. It is nice and has built-in integration with installation profiles, but the export could be more convenient (multiple items of content at once, please!) and import could be made much more robust (given half a chance, we'll reimplement it on migrate).

In the below Drush commands, we are placing the default content in a folder called 'content' within our installation profile. When it is enabled, the Default content module looks there and installs the content at the end of the site install process. So all you need to do is export the content based on ID, which you can glean from the editing interface— it's the number right before /edit, e.g. node seven when edited is at /node/7/edit.

To get a menu item:

drush dcer menu_link_content 1 --folder=profiles/example/content/

And a taxonomy term:

drush dcer taxonomy_term 2 --folder=profiles/example/content/

And a user, which is best to do before these below options, if you want your user-attributed content to be associated with a default user used in creating it:

dcer user 2 --folder=profiles/example/content/

And a node (piece of content) is simply:

drush dcer node 12 --folder=profiles/example/content/

And a comment (not currently exported with its node) will be:

dcer comment 3 --folder=profiles/example/content/

For a custom block (the placement of the block is exported as configuration, not content) use:

drush dcer block_content 1

Oops, left off the folder flag there... or did i? We highly recommend you add a command-specific default parameter for dcer with the folder for your project's content, so you can just ignore it. You can do that with a drushrc.php (in a drush folder in the project root) with contents such as:

['dcer'] = array(
'folder' => 'profiles/example/content',

... changing 'example' to your profile name.

Searched words: 
drupal 8 migrate menu item drupal 8 how to use default content drupal 8 config sync post hook drupal 8 json migration drupal 8 default content menu link to node drush dce menu item default content drupal 8 export taxonomy terms and custom blocks


Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.