[later phase] Introduce `FieldTypeStorageForJsonSchemaDefinition` plugin type

Created on 26 July 2024, 5 months ago
Updated 14 August 2024, 4 months ago

Overview

✅ Unblocked by 📌 Support complex SDC prop shapes: introduce (Storable)PropShape to compute field type storage settings Fixed .
⚠️ Soft-blocked on 📌 Auto-create/update Component config entities for all discovered SDCs that meet XB's minimum criteria Fixed .
⚠️ Soft-blocked on 📌 Introduce `hook_storable_prop_shape_alter()`, use it to prefer the Media Library widget for "image" PropShape if Media Library is installed Fixed .

📌 Support complex SDC prop shapes: introduce (Storable)PropShape to compute field type storage settings Fixed pragmatically hardcodes a StorablePropShape for json-schema-definitions://experience_builder.module/image.

That is merely one of many possible $ref definitions — and in fact, even the XB module alone provides multiple.

📌 Support complex SDC prop shapes: introduce (Storable)PropShape to compute field type storage settings Fixed only is able to generate choices for all of the natively supported JSON schema string formats, as well as enums etc, but not for arbitrarily complex type: object compositions that may have some semantical meaning.

That hardcoding is too limiting — the only acceptable hardcoding is for what the JSON schema spec itself supports.

Note: once [PP-1] Allow schema references in Single Directory Component prop schemas Postponed lands, this will become even more important!

Proposed resolution

In discussing this with @lauriii, we think:

  • that defining such new types (to be finalized in #3352063 in core) will likely be as simple as it is today in the XB module: a module that provides a schema.json in their package root, and these become additionally available choices to use in $ref — just like XB provides json-schema-definitions://experience_builder.module/image today
  • the closest equivalent to such a drop-in-a-file-and-plug-and-play in Drupal-PHP-code-land is Drupal's Plugin system.
  • Hence a new FieldForJsonSchemaDefinition plugin type would make sense, whose plugin ID should match the JSON schema definition (e.g. experience_builder.module/image).
  • As a bonus, these choices can use logic that respects the environment: this issue MUST remove the hardcoded nature of 📌 Introduce `hook_storable_prop_shape_alter()`, use it to prefer the Media Library widget for "image" PropShape if Media Library is installed Fixed and instead make this configurable. A simple setting (experience_builder.settings:image_source_preference or something like that 🙏) is not entirely best practice because it cannot express the dependency on either the image or media_library module, but … thanks to 📌 Auto-create/update Component config entities for all discovered SDCs that meet XB's minimum criteria Fixed keeping Component config entities around under the hood, that is actually a non-issue 👍
  • User interface changes

    None.

📌 Task
Status

Closed: works as designed

Component

Page builder

Created by

🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺

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

Comments & Activities

Production build 0.71.5 2024