MapItem violates FieldItemInterface::schema()'s contract - breaks widgets

Created on 18 June 2017, over 7 years ago
Updated 1 February 2023, almost 2 years ago

Problem/Motivation

Originally raised this in #2563843-37: MapItem is broken for configurable fields β†’ but now splitting this off into its own issue.

FieldItemInterface::schema() states:

  /**
   * ...
   *
   * @return array
   *   An empty array if there is no schema, or an associative array with the
   *   following key/value pairs:
   *   - columns: An array of Schema API column specifications, keyed by column
   *     name. The columns need to be a subset of the properties defined in
   *     propertyDefinitions().
   * ...
   */

So since MapItem::schema() returns a value column, you would expect that there must be a value property defined by MapItem::propertyDefinitions().

That is no longer the case, however, since #2229181: MapItem::propertyDefinitions() claims it has a static value property, which is wrong β†’ .

Besides clearly being a violation of the API, this breaks any widget that you try to write for MapItem as widgets rely on the aforementioned relationship between schema columns and properties. Possibly other things are broken as well, but this is the one I encountered.

Proposed resolution

Roll back #2229181: MapItem::propertyDefinitions() claims it has a static value property, which is wrong β†’ .

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
FieldΒ  β†’

Last updated about 17 hours ago

Created by

πŸ‡©πŸ‡ͺGermany tstoeckler Essen, Germany

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

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.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request β†’ as a guide.

    Seems the last patch had some failures in D8 (triggered for D10)

    Think we will need a test case also to show the issue.

Production build 0.71.5 2024