Closed (fixed)
Project:
UI Patterns (SDC in Drupal UI)
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 May 2025 at 06:37 UTC
Updated:
5 Aug 2025 at 11:39 UTC
Jump to comment: Most recent
Comments
Comment #3
christian.wiedemann commentedComment #4
christian.wiedemann commentedCan you check this if the behavior is right now. Now the component with "replaces" inside is taken into account for building slots and props in layout builder and library. But still both component appears. Is this right?
Comment #5
pdureau commentedI think we need to leverage this Core issue #3391978: SDC: Add a method to retrieve only components not replaced by others to:
ui_patterns_library)ui_patterns) when#render_slots is true#render_slots is false (so inui_patterns_layouts)If we don't want to wait for the Core issue to be fixed, let's accelerate it and make a compatible change while waiting.
Don't you think?
Comment #6
christian.wiedemann commentedYes you are right but I think we should also hide the component in the library.
Comment #7
christian.wiedemann commentedSo I hide the components with a "replaces" from component selector / Layout and UIP UI. Inside the library it is a bit more complicated. Right now both components are visible but htis does not make sense from my point of view.
We should also hide the "replaces" component and inside the single view of the component we should switch from "replaces" to "Replaced by". Good?
Comment #8
pdureau commentedI don't have strong opinion about this. So, let's do as you want or let's ask the team.
We must hide the replaced component and show only the replacing component, right? So what would be the use of showing "Replaced by" info in replaced components?
Comment #9
pdureau commentedComment #10
christian.wiedemann commentedFor clearification:
A Card from a base theme (BaseCard) is overwriten with a SubCard inside a theme.
So right now I hide SubCard everywhere because this SubCard should not be used for mapping or something else. It should always used the BaseCard as mapping target but with props/slots and template from the SubCard. We must ensure that already existing configs are working so we can't hide the BaseCard. Inside the library I would also recommend to hide the SubCard and only render the BaseCard with new slots and props and twig template and only say with "Replaced By" that the subcard is used here.
Hope it is more clear now.
Comment #11
pdureau commentedSo, your proposal is:
What happen if a component is replaced by many others ("SubCard1" and "SubCard2") ? What happen if a replacement is replaced ("SubSubCard") ? I guess we need to follow the SDC rendering logic.
Comment #12
pdureau commentedAlso, what about stories? We merge?
Comment #13
pdureau commentedComment #14
christian.wiedemann commentedComment #15
christian.wiedemann commentedI finalized the library integration and fixed some implementation detaisl. Ready to merge from my side.
I also checked the negiation mechanisms for the component itself. It is quite straightforward. It is done in ComponentNegotiator with. First it is checked if the component is in your theme and than the module weight is used for filtering the right component id.
So there is only one replacement which is taken. The patch uses also the ComponentNegotiator to return the right id for the definition itself.
Comment #16
pdureau commentedTo review.
Comment #18
just_like_good_vibesAs we discussed,
it would be better to have two new methods in the decorated sdc service, to be able to get SortedDefinitions and getGroupedDefinitions with replacements.
we need nice names :)
Comment #19
christian.wiedemann commentedI added the two new functions getNegotiatedSortedDefinitions and getNegotiatedSortedDefinitions getNegotiatedGroupedDefinitions and adjust all the places where we need the "real" definition".
We can discuss this with Pierre if we may move this to core.
Comment #20
just_like_good_vibesas discussed, we will merge stories form replaced component and replacer
Comment #22
just_like_good_vibesComment #23
grimreaperHello,
I am updating on 2.0.5 on Sobki and I got the following error:
It seems that now components with a "replaces" key does not appear anymore in the available plugins.
Also I saw in the commit a change in the library template, should a change record be made?
Comment #24
christian.wiedemann commentedHi,
this is done by design because site builders should always use the base component in configuration. So
ui_patterns:ui_suite_bootstrap:grid_row_2instead ofui_patterns:sobki_theme_bootstrap:grid_row_2.The patch fixes the overwrite problems. So you see all slots/props from the replaced component inside layout builder.
The problem is that existing configs could be a problem. Especially content overwrites. Maybe we readd "replaces" components for layouts.
Comment #25
grimreaperThanks for the reply.
Then in this case what is missing is an update hook for existing config and layout overrides.
Without this update, not possible to fix those config (except by editing config files or from admin) and not possible to fix layout overrides due to fatal error.
I can share some code for looping on layout overrides if needed.
Comment #26
pdureau commentedComment #27
grimreaperComment #28
christian.wiedemann commented