Module Development

Use Configuration Entities in a Module's Settings Form for Drupal 8, 9, 10, and 11

While we've already created configuration entity forms for creating, editing, and deleting configuration entities, in this tutorial, you'll learn how to use configuration entity data in the context of a module's settings (configuration) form. We'll refactor the module settings form we created previously and replace the textfield form element with a dropdown select list of our custom video preset configuration entities we created in another tutorial.

By the end of this tutorial, you should be able to:

  • Load configuration entities using an injected entity_type.manager service
  • Update the module settings form to use a select list of configuration entities
  • Save the settings form with the refactored field