Problem/Motivation
UI Suite DSFR need to be able to validate 2 "themes" together, so they are suggesting to introduce a dependency system:
system:
label: "System"
key: data-fr-scheme
target: html
light:
label: "Light"
key: data-fr-scheme
target: html
dark:
label: "Dark"
key: data-fr-scheme
target: html
mourning_system:
label: "Mourning system"
key: data-fr-mourning
target: html
value: ''
dependencies:
- system
mourning_light:
label: "Mourning light"
key: data-fr-mourning
target: html
value: ''
dependencies:
- light
mourning_dark:
label: "Mourning dark"
key: data-fr-mourning
target: html
value: ''
dependencies:
- dark
Proposed resolution
Only one theme is activated by the user, the form element stays a select list.
If a theme with dependencies is activated, the other themes are also activated, so the attributes, meta element & classes of all themes are added to the page markup.
If a dependency is listed but is not found, let's ignore it, process as usual, and push a warning log message.
Comments
Comment #2
yassrzg commentedComment #3
pdureau commentedComment #4
grimreaperHi,
Thanks for your interest in UI Skins. This will be a nice addition.
"Needs work" status is for when some patches or MR not ready had been created. If there is no code already shared, it should be "Active".
Comment #5
yassrzg commentedComment #6
yassrzg commentedComment #8
pdureau commentedHello Yassine,
Thanks for your MR.
You worked on Drupal\ui_skins\HookHandler\PreprocessHtml but it would be better to keep thsi class as simple as possible and add the mechanism to the plugin manager.
Instead of duplicated the values:
You need to set a recursive call which browse the dependency tree. A theme can have multiple dependencies, and those dependencies can have dependencies.
Also, it seems this is missing:
Comment #9
grimreaperHello,
@yassrzg, a complement of the discussion we had yesterday: the logic of gathering $plugin_definitions recursively should be added in the ui_skins/src/Theme/ThemePluginManager.php and in the interface.
So it can be reused somewhere else.
Comment #10
yassrzg commentedComment #11
grimreaperComment #12
grimreaperComment #13
grimreaperComment #14
grimreaper