Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

GraphQL Compose: Entity form modes

Security covered Under active development

Part of the Graphql ecosystem · 39 projects

This module makes entity form mode field definitions and structure available through GraphQL. This allows headless applications to retrieve and display form fields, including their settings and groups, and to even pre-fill forms with existing data.

Exposes entity form mode field definitions and structure via GraphQL for headless applications.

Requirements

Schema Extension

Adds the entityFormMode field to the Query root type:

extend type Query {
  entityFormMode(
    entity_type: EntityType!
    entity_bundle: String!
    entity_id: String
    operation: Operation
  ): EntityFormModeResponse
}

Response Type

type EntityFormModeResponse implements Response {
  success: Boolean
  errors: [Violation]
  form: Json
  form_mode_fields: Json
  form_mode_field_groups: Json
}

Query Example

Retrieve form fields for a node bundle (create operation)

query GetNodeFormFields {
  entityFormMode(
    entity_type: NODE
    entity_bundle: article
    operation: CREATE
  ) {
    success
    errors {
      message
    }
    form_mode_fields {
      machine_name
      type
      required
      weight
      settings {
        cardinality
        type
      }
      widget {
        #type
        #title
        #description
        #required
      }
      existing_values
    }
    form_mode_field_groups {
      machine_name
      label
      format_type
      parent_field_group
      children
      weight
    }
  }
}

Retrieve form with pre-filled values (update operation)

query GetNodeFormFields {
  entityFormMode(
    entity_type: NODE
    entity_bundle: article
    entity_id: "123"
    operation: UPDATE
  ) {
    success
    form_mode_fields {
      machine_name
      existing_values
    }
  }
}

Permission Handling

Access control uses graphql_compose_mutations.user_permissions service:

  • Validates user permissions via userCanDoActionOnEntityByType()
  • Administrators (uid=1 or 'administrator' role) bypass permission checks
  • Returns validation violations if access is denied

Widget Properties Filter

To prevent JSON recursion, only these widget properties are returned:

  • #base_type, #date_date_format, #date_time_format, #date_timezone, #date_year_range
  • #delta, #description, #description_display, #form_group, #id, #name
  • #options, #placeholder, #required, #title, #title_display, #type
Drupal 10–11

Ask your assistant about GraphQL Compose: Entity form modes

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Jan 2026
Latest release
8 months ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Slowing

Releases

Version Type Core PHP Release date
1.0.0 Stable 10–11 Jan 21, 2026
1.0.x-dev Dev 10–11 Jan 21, 2026