Wasim's Site

Drupal Content Type & Field Generator

Generate Drupal content type configuration YAML — node.type.*.yml plus field.storage and field.field files for each field.

Content Type

Add Field

Configuration Files (1)

Place each file in your config sync directory (or a module's config/install/) under its exact name.

node.type.article.yml

Generating Drupal Content Type Configuration

In Drupal, a content type and its fields are not one file — they are several interlocking config entities. The content type itself is a node.type.*.yml, while each field splits into a shared field.storage.*.yml and a per-bundle field.field.*.yml. Getting the dependencies, ids, and settings right by hand is exactly the kind of repetitive work that slows down module development. This generator emits all of those files, correctly linked, from one form.

The Three File Types

  • node.type.<bundle>.yml: the content type definition (name, description, revision settings).
  • field.storage.node.<field>.yml: the global field storage — type, cardinality, storage settings.
  • field.field.node.<bundle>.<field>.yml: the field instance attaching storage to this content type.

How to Use This Generator

  1. Define the content type — label, machine name, and description.
  2. Add fields with a type, cardinality, and whether they're required.
  3. Copy or download each YAML file into your config sync or module's config/install/.
  4. Import with drush config:import or by installing the module.

Frequently Asked Questions

What configuration files make up a Drupal content type?
A content type is a node.type.<bundle>.yml config entity. Its fields are separate: each field needs a field.storage.node.<field>.yml (the storage definition, shared across bundles) and a field.field.node.<bundle>.<field>.yml (the per-bundle instance). This tool generates all of them.
What is the difference between field storage and field instance?
Field storage defines the field globally — its type, cardinality, and database-level settings — and can be reused across content types. The field instance attaches that storage to one bundle with a label, a required flag, and bundle-specific settings.
Where do these YAML files go?
Into your configuration sync directory for site config, or a module's config/install/ folder to ship the content type with a module. After placing them, run drush config:import (or install the module) to apply.
What does cardinality mean?
Cardinality is how many values the field can hold: 1 for a single value, a fixed number like 3, or unlimited (-1) for an add-as-many-as-you-want field. It is stored on the field storage definition.
Are the generated settings complete for every field type?
They include the standard storage and instance settings Drupal writes for each type (e.g. max_length for string, target_type for entity reference, datetime_type for date). Review and adjust specifics — like an entity reference target bundle or list allowed_values — for your exact needs before importing.

Official Resources