Problem/Motivation
Today, "Data from a field" ("[Entity] => [Field]" starting UI Patterns 2.0.5) is a single source in the Blocks library panel. So, we need to drop it and then pick the chosen field in the instance panel.
Proposed resolution
Add a new "Field" section in the Blocks library panel, alongside "List (Views)", "Menus" and "Others".
However, it will not be hardcoded like "List (Views)", "Menus" and "Others" (it was OK to hardcode them because they are Drupal blocks), but it will rely on the ui_patterns_overrides's SourcesBundlerInterface to get the list of sources.
So, instead of dragging only to the builder panel:
source_id: entity_field
source: { }
We are dragging directly something like that:
source_id: entity_field
source:
derivable_context: 'field:node:article:title'
'field:node:article:title':
value: {}
It would be nice to move this SourcesBundlerInterface logic to UI Patterns 2 by the way: #3513568: [2.0.7] Source usability : better interfaces for sources relying on child plugins
| Comment | File | Size | Author |
|---|
Issue fork display_builder-3529260
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
mogtofu33 commentedComment #3
pdureau commentedWould it be possible to do the same for
[Entity] ➜ Referenced [Entity]"?So, with both modifications:
Comment #4
pdureau commentedComment #5
pdureau commentedComment #8
pdureau commentedThanks for your ongoing work.
Can you also remove
SourcesBundlerInterfaceandComponentSourcefromui_patterns_overridesmodule? You will need to update the class actually depending on this interface:SourcesBundlerInterface::getOptionLabel()by something fromSourceWithChoicesInterfaceSourcesBundlerInterface::getDataSkeleton()bySourceWithChoicesInterface::getChoiceSettings()SourcesBundlerInterfaceSourcesBundlerInterfacedoesn't make sense hereWe also need to check the UI (not because UI is part of this issue scope, but because it will tell us if we did things the right way):
Comment #9
just_like_good_vibesComment #11
mogtofu33 commentedComment #13
mogtofu33 commentedWhen moving a component we have now an error.
Seems this broke the component library, adding a component_id when we want an instance_id. Either we create it as what getDataSkeleton was doing or we need to change the ApiController.
Comment #15
mogtofu33 commentedBecause it's a big regression I set back the getDataSkeleton, let me know if there can be optimization here.
Comment #17
just_like_good_vibesi posted an update of the code which seems to correct the issue,
but this issue in ui_patterns is needed : https://www.drupal.org/project/ui_patterns/issues/3540835
Comment #18
just_like_good_vibesComment #19
just_like_good_vibesComment #20
just_like_good_vibesComment #22
mogtofu33 commentedStill not good, had to fallback to:
Comment #25
mogtofu33 commentedAs discussed with @just_like_good_vibes seems working with ui_patterns 2.x-dev and 2.0.8 release, so need to come back and finish here when 2.0.8 is out.
Comment #27
just_like_good_vibesand finally :)
Comment #28
grimreaperThanks!
It fixes the fatal on latest dev version of ui_patterns 2.0.8.
Comment #29
just_like_good_vibesthis fix has been pushed and re-pushed again until we finally have it now with a clean dependency to a required ui_patterns min version.
finally... but this is not finished, we will follow-up - in that issue or not? - performances issues introduced now.
Comment #30
mogtofu33 commentedComment #32
mogtofu33 commentedLet's have a follow up issue for the performance.