Needs review
Project:
UI Patterns (SDC in Drupal UI)
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
20 May 2026 at 19:29 UTC
Updated:
26 Jul 2026 at 11:27 UTC
Jump to comment: Most recent
Comments
Comment #2
pdureau commentedComment #4
pdureau commentedWorks have started with #3590492: Tidy the source plugins tags as a starting point.
Mikael, can you help us document the properties of:
When finished, let's leave it in RTBC without merging, and discuss.
Maybe the change will break ecosystem (like
ui_icons_patterns) and we will keep it for 2.1.0. Maybe it will be OK (because are DTO have ArrayAccess for example) and we can merge in 2.0.xComment #5
pdureau commentedWorking on this subject.
Comment #6
pdureau commentedFixed by introducing a (temporary?)
ArrayAccessTraitto implements<code>ArrayAccessinterface on DTOs.#3590426: Reduce the API scope of our plugin managers and #3590492: Tidy the source plugins tags must be merged first.
Comment #7
pdureau commentedThere is also
SourceInterface::getCustomPluginMetadata()methods, called only twice:$field_name = $this->getCustomPluginMetadata('field_name');inFieldValueSourceBase$property = $this->getCustomPluginMetadata('property');inFieldPropertySourceThey belong to
SourceMetadataI guess, it was forbidden when annotating the properties with comments.Does that mean they are "special" and something specific must be done?
Comment #8
pdureau commentedLet's investigate this before sending to review:
Comment #9
pdureau commentedLet's talk
Comment #10
pdureau commentedThis is the 2nd part of a three steps effort to prepare UI Patterns Next while staying in 2.0.x branch for now: https://docs.google.com/presentation/d/11NsN1c5prlWrB0AlEKOxE4q5MOFHx-N_...
#3590492: Tidy the source plugins tags must be merged first.
Added DTO classes implementing ArrayAccess:
Removed metadata:
Comment #11
pdureau commentedOopsy. The change from array to DTO is breaking Display Builder and probably other modules from ecosytem:
Because we target 2.0.x branch, we need to add a compatibility layer.
Comment #12
pdureau commentedDisplay Builder compatibility fixed:
Adding a DTO is more risky than adding an enum, we may break stuff. Let's be very careful before merging it.
Comment #14
smovs commentedHi @pdureau and @just_like_good_vibes!
I used Claude to double-check for edge cases, and it identified two potential concerns.
I added a NULL guard to getChoices() and SourcePluginBase.
There are also concerns about the metadata annotation using the wrong entity type. We currently use DerivableContextMetadata, while Claude suggested that source plugins should use SourceMetadata instead.
Claude also suggested several more invasive code changes, but I didn’t implement them without discussing them first.
Concerns identified by Claude:
1.
getChoices() — unguarded NULL->provider (DerivableContextSourceBase.php:503-507)The DerivableContext attribute now defaults metadata to NULL. Any derivable-context plugin that doesn't route through EntityFieldSourceDeriverBase (i.e. any contrib one) has metadata === NULL → fatal.
Core's two plugins both inherit a SourceMetadata, which is the only reason it's green.
2.
getCustomPluginMetadata() — unguarded property access (SourcePluginBase.php:397-403)return $plugin_definition['metadata']->{$key}; // was: guarded, returned NULL on missFatals if metadata is NULL (any non-field Source plugin) or a key is absent. Safe today only because the two callers are field sources that always have metadata — but this is a general protected helper any source subclass can call.