33 lines
1.4 KiB
Markdown
33 lines
1.4 KiB
Markdown
|
---
|
|||
|
title: Experimenting with the Default Content module
|
|||
|
date: 2024-09-16
|
|||
|
permalink: daily/2024/09/16/experimenting-with-the-default-content-module
|
|||
|
tags:
|
|||
|
- software-development
|
|||
|
- drupal
|
|||
|
- drupal-modules
|
|||
|
- php
|
|||
|
cta: ~
|
|||
|
snippet: |
|
|||
|
I've recently been experimenting with the Default Content module.
|
|||
|
drupal_planet: true
|
|||
|
---
|
|||
|
|
|||
|
I recently sent a database to a client whose new Drupal website I'm building.
|
|||
|
|
|||
|
I'd populated it with some default users, nodes and menu links that they'd be able to review after they import the database into their hosting.
|
|||
|
|
|||
|
That worked well, but I've also recently been using the [Default Content module][0] which exports entities into YAML and saves them as code alongside the configuration.
|
|||
|
|
|||
|
Now I can install the website from scratch using the exported configuration to re-add the content types, block types, etc, and by enabling a custom module, all the default content will also be recreated.
|
|||
|
|
|||
|
I can tear the site down now and rebuild it as often as I like and avoid contaminating my environment with any rogue configuration or content changes.
|
|||
|
|
|||
|
Everything is reproducible.
|
|||
|
|
|||
|
I also wouldn't have needed to send the database to the client. They could have installed Drupal and followed the same steps I would do locally and got exactly the same result.
|
|||
|
|
|||
|
I like this approach and can see me using it more on future projects.
|
|||
|
|
|||
|
[0]: https://www.drupal.org/project/default_content
|