Custom blocks missing if two modules/themes declare the same category

Created on 15 August 2024, 3 months ago
Updated 30 August 2024, 3 months ago

Problem/Motivation

Currently if you have two modules or themes defining blocks in the mymodule.gutenberg.yml file using the same category reference, the later processed module will overwrite the blocks of the first one. Essentially you will not be able to make custom blocks of the first module with the same category available at all.

It would be good if multiple modules/themes could add blocks for example to the "Layout" category.

Currently it behaves the following.

mymodule_a.gutenberg.yml

custom-blocks:
  categories:
    - reference: layout # The category where the block will be added.
      name: Layout
      blocks:
        - id: custom-card-block/custom-card-block
          name: Custom Card Block

mymodule_b.gutenberg.yml

custom-blocks:
  categories:
    - reference: layout # The category where the block will be added.
      name: Layout
      blocks:
        - id: custom-example-block/custom-example-block
          name: Custom Example Block

Then the custom blocks from mymodule_a will not be selectable in the node type form and therefore cannot be used in Gutenberg.

Steps to reproduce

Proposed resolution

If a category reference was already defined then the blocks of mymodule_b should merge into the existing category, so that all blocks can be configured and enabled/disabled.

It of course would not solve, if a the second module defines a different name for the category, but I think that's a minor problem compared to the real-life problem described above.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇩🇪Germany szeidler Berlin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024