Problem/Motivation
While working on #3594176: Slot handlers as island plugins, I am confused with the instance-id data attribute added by BuilderPanel, LayersPanel and PresetLibraryPanel:
'#attributes' => [
'data-db-id' => $builder_id,
'data-slot-id' => $slot_id,
'data-slot-title' => \ucfirst($definition['title']),
'data-node-id' => $instance_id,
'data-instance-id' => $instance_id . '_' . $slot_id,
],
which has been added in March by https://git.drupalcode.org/project/display_builder/-/merge_requests/253/
Because it is never an Instance entity ID, and only sometimes and Tree Node ID (tree nodes were also previously called" instance"). Sometimes it is a tree node id, sometimes it is a preset entity ID, sometimes it is a combination of node ID and slot, sometimes it is an opaque string...
The current difficulties to pass the playwright tests in #3594176: Slot handlers as island plugins may be related to this confusion.
Proposed resolution
- Rename
data-instance-idwithdata-test-id - Add a comment explaining this attribute is related to https://playwright.dev/docs/locators#locate-by-test-id (I am not comfortable with markup added only for playwright tests, this is making the DOM busy, but this is not the topic of this ticket)
- Add missing
data-node-idin BuilderPanel and LayersPanel
Also, if relevant, add the "Pass a full InstanceInterface between BuildePanel" part from #3594176: Slot handlers as island plugins.
Issue fork display_builder-3606874
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
pdureau commentedComment #3
pdureau commentedComment #5
pdureau commentedReady for review. A warning in
playwright_extra, i don't really know if it is blocking a MR or not.