Problem/Motivation
UI pattern sources like component or blocks, rely on child plugins.
should have :
- an interface (and factorized implementation like a trait?) to allow to fetch the list of child plugins from outside the source.
- improved source label when child plugin is selected
- settings presets/skeletons for a source when a child plugin is known.
Issue fork ui_patterns-3513568
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
just_like_good_vibesComment #4
pdureau commentedI am not sure about the naming...
Proposal inspired from [ObjectWithPluginCollectionInterface](https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Plugin%21...) but not identical because we have a single collection and not many collections:
Do we also need a
getItemLabel(string $item_id): string?Also, it may be good to move
::getMinimalConfiguration()to SourceInterface and to implemtn it in SourcePluginBase as a proxy toPluginSettingsInterface::defaultSettings(). What do you think?Comment #5
just_like_good_vibesgetMinimalConfiguration does not need any parameter, unless it is static, which could be a nice idea after all.
i don’t like collection, because it reminds of the plugin collections in drupal which are managed differently…
Comment #6
just_like_good_vibesalso, the term configuration for the source refers to the global configuration, whereas we wanted the settings, i would keep settings to avoid confusion
Comment #7
pdureau commentedYou have the same parameter in the MR:
getSettingsSourceWithChildPlugin(string $plugin_id): array;Let's find a synonym
OK
Comment #8
pdureau commentedIs it better?
Also:
Comment #9
just_like_good_vibesi am not so fan of items neither :)
Comment #10
pdureau commentedComment #11
pdureau commentedToo late for 2.0.X
Comment #12
pdureau commentedComment #13
pdureau commentedComment #15
pdureau commentedUI Patterns 2 sources where we want to extract multiple item.
Reminder: Only for slots source.
Nice to have
ComponentSource with
bootstrap:card:BlockSource with
system_menu_block:admin:Expected in the scope of this issue
Entity Field with
field:node:article:title:Entity Reference with
entity_reference:node:article:uid:user:user:Out of scope
Because single item:
Multiple items context never reached from the top of a component data tree:
Comment #16
pdureau commentedThanks for your ongoing work.
It would be nice to also implement this interface on
ComponentSourceso it will be possible to get the same simplification in display_builder'sComponentLibraryPanel.Also, we may need to add some properties in ::getChoices() along side
labelandprovider: like the original plugin ID and the group/category.It would be even better to return an object implementing standard interfaces instead of a loose array:
labelandgroup/categoryCan you also add this to EntityReferencedSource or DerivableContextSourceBase ?
Comment #19
just_like_good_vibeshere we are, ready for review :
- we have a new interface for those sources with a choice. It allows them to expose those choices to the outside world.
- we have improved the returned label of sources, in those particular cases of sources with choice.
Comment #20
pdureau commentedComment #22
pdureau commented