Make Gutenberg entity-type-agnostic

Created on 4 August 2020, almost 5 years ago
Updated 24 May 2023, almost 2 years ago

Problem/Motivation

Gutenberg is currently written primarily with Node entities in mind.
I think the module should be flexible enough to work with most (content) entity types e.g. Taxonomy terms.

As part of this work, I think we should move away from storing all the configurations in gutenberg.settings.yml and moving towards storing them as third_party_settings on the entity type and working from there.
This also makes it easier to map the configuration to a schema rather than dynamically setting them.

https://www.drupal.org/project/config_inspector may be used to inspect the configuration schema.

Proposed resolution

  • Add update hook deprecating gutenberg.settings, and moving active Gutenberg settings into the appropriate node type third party settings.
  • Introduce a new dedicated entity type settings page to configure Gutenberg.
  • Introduce a new Gutenberg setting which allows admins to specify the text field to use for Gutenberg rather than defaulting to the first text field.
  • Support YAML and JSON on the Field Mapping template definitions - since YAML is a superset of JSON, we can safely use Yaml::decode rather than json_decode, YAML is way more human friendly to use and fits well with the Drupal ecosystem.
  • Introduce some kind of API to specify which entity types should support Gutenberg (thoughts welcome on this).

Remaining tasks

Implement as part of the #3107797: Dynamic render blocks support (API rework using WordPress block parser rather than regex) work.

User interface changes

  • Move the Gutenberg settings into its own page/tab (Similar to Field Settings)
  • Support YAML for the Field Mapping template textarea

API changes

N/A

Data model changes

  • The gutenberg.settings configuration will be moved into the relevant node.type.$entity_type third_party_settings.
📌 Task
Status

Needs review

Version

2.0

Component

Code

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇹🇭Thailand AlfTheCat

    RE: #39 the patch doesn't support blocks, but I think it would be fantastic if that could be added to the scope. Having Gutenberg in blocks is a powerful page building asset.

  • Status changed to Needs work over 1 year ago
  • 🇳🇴Norway eiriksm Norway

    This MR needs to be rebased or merged up to date

  • Status changed to Closed: duplicate 11 months ago
  • 🇳🇴Norway thorandre

    This is a duplicate of #3445655 where we'll continue to work on this.

  • This is something that I have wanted to use in the block types. Is this patch compatible with the current version of the module?

Production build 0.71.5 2024