Module Development

Define a Configuration Schema and Default Values for Drupal 8, 9, and 10

Modules must provide metadata about their configuration data via a schema definition, which serves localization and validation purposes. Modules can optionally specify default configuration values to ensure that the module functions when installed.

In this tutorial, we'll:

  • Define schema for the Anytown module's configuration.
  • Set default module settings.

By the end of this tutorial you should be able to define a configuration object's schema and default values.

Drupal Module Developer Guide