Module Development

Retrieve and Update Weather Forecast Settings for Drupal 8, 9, 10, and 11

Modules in Drupal often rely on the Configuration API to adapt their behavior based on administrator-defined settings. This involves both reading values from configuration objects in custom code and enabling administrators to modify these values with a settings form.

In this tutorial, we'll:

  • Demonstrate accessing configuration data with the config.factory service.
  • Examine the module's settings form's interaction with the Configuration API.
  • Adjust the WeatherPage controller's behavior based on administrator-defined configuration.

By the end of this tutorial, you should be able to read and output simple configuration data within a module.

Drupal Module Developer Guide