defaultStorageSettings() and defaultFieldSettings() should document that they must not have setting names in common

Created on 16 May 2024, about 1 month ago
Updated 3 June 2024, 25 days ago

Problem/Motivation

These two methods in FieldItemInterface look like they're totally separate, but other parts of core assume that the setting names are distinct.

For example in BaseFieldDefinition the two arrays are merged:

    $default_settings = $field_type_manager->getDefaultStorageSettings($type) + $field_type_manager->getDefaultFieldSettings($type);

Steps to reproduce

Proposed resolution

Document in both methods that setting names must be different from the ones returned by the other method.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
DocumentationΒ  β†’

Last updated about 6 hours ago

No maintainer
Created by

πŸ‡¬πŸ‡§United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

  • Issue created by @joachim
  • Status changed to Needs work about 1 month ago
  • πŸ‡΅πŸ‡°Pakistan isalmanhaider

    Explanation:

    In Drupal 11, the FieldItemInterface includes two methods: defaultFieldSettings() and defaultStorageSettings(). These methods define default settings for field items at different levels:

    - defaultFieldSettings(): Specifies default settings at the field level.
    - defaultStorageSettings(): Specifies default settings at the storage level.

    Issue:

    The methods are expected to return settings with unique names. This is crucial because other parts of the core, like BaseFieldDefinition, merge these arrays. Overlapping names can lead to conflicts or unexpected behavior.

    Solution:

    Document in both methods that setting names must be distinct to avoid such issues.

  • πŸ‡¨πŸ‡¦Canada KarimB

    We are going to take this issue as part of the Symetris β†’ contribution workshop.

Production build 0.69.0 2024