Module Development

Load and Save Configuration Entity Data for Drupal 8, 9, and 10

In this tutorial, we'll cover how to load configuration entity data in a module. We'll change the AdminSettingsForm.php we created and replace the simple textfield we were using with a dropdown select list. Then we'll use data from our Transcode Profile module's configuration entity, loaded by the EntityTypeManager via the services container, to choose our preferred Transcode Profile.

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

  • Know how to load configuration entities using EntityTypeManager via the services container
  • Update the AdminSettingsForm.php to use a dropdown select list
  • Save your preferred transcode profile from a list of transcode profile entities
  • Update the default configuration provided with the demo module to include transcode profiles