Drupal is a registered trademark of Dries Buytaert
drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). eca 3.1.1 Minor update available for module eca (3.1.1). layout_paragraphs 2.1.3 Minor update available for module layout_paragraphs (2.1.3). ai 1.3.3 Minor update available for module ai (1.3.3). ai 1.2.14 Minor update available for module ai (1.2.14). node_revision_delete 2.0.3 Minor update available for module node_revision_delete (2.0.3). moderated_content_bulk_publish 2.0.52 Minor update available for module moderated_content_bulk_publish (2.0.52). klaro 3.0.10 Minor update available for module klaro (3.0.10). klaro 3.0.9 Minor update available for module klaro (3.0.9). layout_paragraphs 2.1.2 Minor update available for module layout_paragraphs (2.1.2). geofield_map 11.1.8 Minor update available for module geofield_map (11.1.8).

This module automatically generates Drupal Forms directly from defined schemas, using the structure, labels and validation constraints from the schema definition.

It auto generates forms for configuration entities, config objects like module settings page, and for any other schema you want!

Simply put, to create a form page, you should only describe the data schema in a YAML schema file, and that's it. The form page will be generated automatically without custom code at all. But, if you need, you still can alter the form and add your customizations automatically over auto-generated form.

Schema Form Designs

You can customize the form by adding and overriding the schema data using the Schema Form Design entities, without modifying the data schema itself.

Examples

Here are some short examples:

Configuration form (API settings form)

file config/schema/my_module.schema.yml:

my_module.my_api_settings:
 type: config_object
 label: My API Settings
 mapping:
   endpoint:
     type: string
     label: Endpoint URL
     description: URL of the my-api.com endpoint.
   access_token:
     type: string
     label: Access Token
     description: An alphanumeric string 32 characters long.

file my_module.routing.yml:

my_module.my_api_settings:
 path: '/admin/config/system/my-api'
 defaults:
   _form: 'Drupal\schema_form\SchemaConfigFromRouteForm'
   _title: 'My API Settings'
 requirements:
   _permission: 'administer site configuration'
 options:
   editable_config_names:
     - my_module.my_api_settings

And that's all that you need! Only two YAML files generate a fully working configuration page with auto-generated form, validation and saving the values to the Drupal config.

Auto-generated basic Site Settings form (from the Drupal Core) with no code

The system.site schema is already defined in the Drupal Core, so we need only a single file to declare a route, connected to this schema:

file my_module.routing.yml:

my_module.basic_site_settings:
 path: '/admin/config/system/site-information-nocode'
 defaults:
   _form: 'Drupal\schema_form\SchemaConfigFromRouteForm'
   _title: 'Basic site settings'
 requirements:
   _permission: 'administer site configuration'
 options:
   editable_config_names:
     - system.site

And that's it! This route automatically generates a page /admin/config/system/site-information-nocode with the form, similar to the Drupal Core's form, written using 200+ lines of the custom PHP code.

See more detailed documentation and examples here.

Custom Config Entity forms

file config/schema/my_module.schema.yml:

my_module.my_config_entity.*:
 type: config_entity
 label: My config entity
 mapping:
   id:
     type: string
     label: ID
     description: Unique identifier for the config entity.
   myString:
     type: string
     label: My String
     description: A string value.
   myNumber:
     type: integer
     label: My Number
     description: An integer value.

See more detailed documentation and examples here.

Regular forms

You can use this module not only for configuration forms, but for any form you want! Instead of building a long PHP array for the form, you just need to describe the schema and that's it. See the examples in the separate documentation here.

Documentation

More detailed documentation and examples are published on a separate resource: Schema Form Drupal module documentation »

Similar projects

  • Automatic Configuration Form - implements the same idea, but targeted only at configuration forms. Does not use plugins, so support is limited to only built-in field types.
  • Schema Based Config Forms - targeted only at configuration forms, extendable by plugins and provides more field types out of the box.

Alternatives, based on content entities »

If you use those modules, you can simply replace them with this module Schema Form without any change in your created schemas, because it supports form declaration formats from these modules too.

Activity

Total releases
5
First release
Apr 2025
Latest release
3 weeks ago
Release cadence
83 days
Stability
0% stable

Release Timeline

Releases

Version Type Release date
1.0.0-alpha4 Pre-release Mar 23, 2026
1.0.0-alpha3 Pre-release Aug 16, 2025
1.0.0-alpha2 Pre-release May 12, 2025
1.0.0-alpha1 Pre-release May 1, 2025
1.0.x-dev Dev Apr 24, 2025