This project is not covered by Drupal’s security advisory policy.

Reordering items with tabledrag renumbers every sibling, so moving one block or field rewrites many weights, often across many files. Config Weight exports weights as a linked list (each item points at its predecessor) and turns them back into normal numeric weights on import. Appending an item touches 1 line, moving one touches up to 3, and inserting at the head touches 2.

weight:
  after: olivero_page_title   # '<root>' marks the head

Active config is never changed. Only the sync directory uses the linked form.

Who it's for

Teams with many developers working on the same site in parallel. When several branches each reorder blocks, fields or filters, numeric weights cause config drift and merge conflicts in files nobody meant to touch. With linked weights, each change only touches the items that actually moved, so branches merge cleanly, reviews show the real change, and every environment ends up with the same order.

Example

An article form display has five fields in this order: title, body, field_tags, field_image, field_summary. A developer drags field_summary up to sit after title.

The exported diff for each approach, with a second example from an image style, whose effects are keyed by UUID:

 moving desaturate to the top changes all three effects with normal weights, but only two with Config Weight; because effects are keyed by UUID, each pointer also has an after_label with the predecessor's plugin id, such as image_desaturate.

On a real display with 20 or 30 components, two developers who reorder different fields on separate branches almost always conflict with normal weights, because both renumber the same lines. With Config Weight, each change touches at most three items, so the branches usually merge cleanly.

Features

  • Finds weighted config automatically from config schema (type: weight): blocks (scoped by theme and region), roles, vocabularies, text formats and filters, entity view/form display components (scoped by region), image style effects, workflow states and transitions, Layout Builder components, and more.
  • Where items are keyed by UUID (image style effects, Layout Builder components), a readable after_label is written next to the pointer, so diffs and merge conflicts show what an item comes after. Import ignores it, and uses it only to name missing items in the log.
    weight:
      after: 734f664d-c11a-4260-9e6b-0d237f7cac1b
      after_label: image_scale
  • If an import doesn't change a sibling set's order, the active weights are kept, so drush config:status stays clean.
  • Repairs malformed lists (merge conflicts, dangling pointers, cycles) in a predictable way and logs what it did.
  • Include/exclude lists by config name, which can be set per environment in settings.php.
  • Works alongside Config Split and Config Ignore (export priority 200, import priority -200, both configurable).
  • Drush commands: config-weight:list, config-weight:report and config-weight:audit.
  • Other modules can adjust discovery with hook_config_weight_overrides_alter().

Removing it

Active config always keeps numeric weights, so Config Weight can be removed at any time without converting anything:

  1. Uninstall the module: drush pm:uninstall config_weight.
  2. Export config. Every weight is written back as a normal core weight, exactly as if the module had never been installed.
  3. Commit and deploy the export as usual. The import uninstalls the module on the other sites in the same step.

Export before deploying: files that still have linked weights lose their order if they are imported on a site without the module.

Requirements

Drupal 11.1 or later.

Limitations

  • Config only. Content entities (taxonomy terms, menu links, book outlines) are not covered.
  • Sync files no longer match config schema for weights, so tools that read the sync directory directly may complain.
  • Single-item config import doesn't run storage transforms, so don't paste linked weights there.
AttachmentSize
config_weight_diff.png305.24 KB

Project information

Releases