Skip to content
Snippets Groups Projects

Field storage

Merged Wim Leers requested to merge field_storage into 0.x

(Legend: :x: = TODO, :white_check_mark: = working)

Goals

  • Being able to create, store, edit and view component trees.
    • Note: viewing component trees must support component prop values of sourceType == static:… ("fixed values") and sourceType == dynamic ("dynamic values": fetched from the host entity using a StructuredDataPropExpressionInterface)
    • WITH test coverage
  • Editing individual sourceType == static:field_item:<field type> prop values using field widgets in modal dialogs.
    • WITHOUT test coverage: viability alone is sufficient

Non-goals

  • Good UX
  • Any UI to change the expression used for a sourceType == dynamic prop value
  • Nested components
  • Translations
  • "default" component trees aka bundle-defined defaults (in the Capabilities Doc: "content type templates"), which this field ought to store the additions/overrides for; it should no repeat the defaults.
  • API representation (JSON:API) or otherwise

MR contents

  • New field type based on @effulgentsia's proposal at https://www.drupal.org/project/drupal/issues/3440578, with 3 properties:
    1. :white_check_mark: tree to store the component tree
      • Here just restricted to a component list, not doing nesting yet. That should happen in !2 (merged).
    2. :white_check_mark: props to store the props values assigned to the components in the tree
    3. :white_check_mark: 932ce4b9: hydrated to compute the combination of both — and available as both a JSON blob with cacheability metadata and as a Drupal render array.
      • :x: … based on configuration, we can achieve symmetric translation or asymmetric translation.
  • With validation:
    • :white_check_mark: the component instance UUIDs in tree and props must match
    • :white_check_mark: 0c4ffd00: each component's assigned prop values must not trigger an InvalidComponentException
    • :x: … much more!
  • With the most minimal UI possible:
    • :white_check_mark: widget: two <textarea>s — validation: see above
      • :white_check_mark: : !15 (d964218b) Edit individual sourcetype: static:field_item:<field type> prop values using their corresponding widgets using modal dialogs — this would increase confidence that we'll be able to pull this off via the React UI eventually:

        field-widget-for-static-sdc-prop-value.gif

      • :x: The above MUST run explicit validation against the SDC props, because e.g. the link field type accepts relative URLs, fragment URLs, etc, whereas the SDC prop does not.

      • :x: Edit individual sourcetype: dynamic expressions using a <select>!20 (merged)

    • :white_check_mark: formatter: reuse the same rendering that was in hook_entity_view_build_alter() and uses _eb_resolve_sdc_prop_value() — refactored to value object in 04ce0599 (belongs elsewhere but trying to avoid conflict with @f.mazeikis' work on adapters@f.mazeikis indicated this was no problem)
      • Out-of-scope here: taking over the entire rendered entity: for the purpose of this MR being able to render the component tree inside a field is sufficient.
  • Moved to !17 (merged) Drop Drupal 10.2 support~~; require Drupal 10.3, due to plugin annotations being deprecated since 10.3: ~~~~https://www.drupal.org/node/3229001~~
  • Tests (minimal)
    • :x: Unit
    • :x: Kernel
Edited by Wim Leers

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
41 41 message: "#^Function experience_builder_toolbar\\(\\) has no return type specified\\.$#"
42 42 count: 1
43 43 path: experience_builder.module
44
45 #
46 # These must be fixed upstream in various interfaces and base classes.
  • fwiw you can add return types now, php supports narrowing of return types on children

  • Author Maintainer

    True. But that alone is not enough. You'll get with no value type specified in iterable type array. for all of the ones that either @return array or have a @param array. Once core defines those, these ignored errors can go away. And … note that I do not have reportUnmatchedIgnoredErrors: false, so PHPStan will fail once this is fixed upstream :smiley:

  • Please register or sign in to reply
  • Wim Leers added 1 commit

    added 1 commit

    • 932ce4b9 - Introduce a third field type property: `hydrated`, which combines `tree` +...

    Compare with previous version

  • Wim Leers changed the description

    changed the description

  • Wim Leers added 1 commit

    added 1 commit

    • 0e6146bb - `cspell` + `phpcs` + `phpstan`

    Compare with previous version

  • Wim Leers added 1 commit

    added 1 commit

    • 0ae66bc9 - `cspell` + really only test 10.3 + 11.0.

    Compare with previous version

  • Wim Leers added 1 commit

    added 1 commit

    Compare with previous version

  • Wim Leers added 1 commit

    added 1 commit

    • 04ce0599 - Converted `_eb_resolve_sdc_prop_value()` to a value object.

    Compare with previous version

  • Wim Leers added 1 commit

    added 1 commit

    • 2860f80d - Thanks to the `StaticPropSource` value object introduced in the previous...

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading