Module Development

Default Configuration in a Module for Drupal 8, 9, and 10

When you create a module for Drupal, it can be useful to provide default configuration. This can be settings for a form, the placement of a block, or something more complex like the default image styles provided by the Image module in core. A module can provide default configuration for simple configuration or configuration entities.

In this tutorial, we will cover:

  • Possible locations for default configuration
  • What happens with configuration when a module is installed or uninstalled
  • Managing dependencies in configuration
  • Where to find examples of default configuration