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:
<?php
$command_specific['dcer'] = array(
'folder' => 'profiles/example/content',
);
?>
... changing 'example' to your profile name.
Comments
Post new comment