Problem/Motivation
As a follow-up of #3612556: PageLayoutSource is sometimes not rendered.
We can't apply styles to PageLayoutSource.
Proposed resolution
Proposal 1: let's assume some source plugins don't handle attributes
PageLayoutSource is not the only source returning a renderable not compatible with #attributes, do we:
- test the renderable on Display Builder side, and load the Style & Tokens panels only if compatible?
- add a specific plugin attributes on UI Patterns side, and load the Style & Tokens panels only if compatible?
If we do something like that, we also need to remove content (a leftover of an intermediary state of #3612556: PageLayoutSource is sometimes not rendered, may be harmful) here:
$build['content'][$slot_id] = $slot;
Proposal 2: Make PageLayoutSource compatible with attributes
For example, by wrapping the page renderable:
return [
// `page` renderable doesn't accept #attributes, so let's wrap it up to
// be able to apply styles and other dynamic attributes.
'#type' => 'html_tag',
'#tag' => 'div',
'content' => $page,
];
However, this is not working with every themes:
- UI suite DaisyUI: ✅ good layout rendering and styles correctly applied
- UI suite Material: ✅ good layout rendering and styles correctly applied
- UI suite DSFR: ✅ good layout rendering and styles correctly applied
- UI suite Bootstrap: ❌
page renderable is not rendered
- UI suite USWDS: ❌
page renderable is not rendered
- bootstrap with I suite Bootstrap styles: ✅ good layout rendering and styles correctly applied
Comments
Comment #2
mogtofu33 commentedComment #3
mogtofu33 commentedTested with UI Suite Bootstrap, the
$build['content'][$slot_id] = $slot;works, but if you set style, then instead of applying to child it make it disappear.So will pass a quick hotfix to dev for
$build[$slot_id] = $slot;.Note that current state is already better than beta5, as current beta5 simply render nothing. So hotfix is only for when a style is applied.
Comment #5
grimreaperComment #7
grimreaperComment #8
pdureau commentedi will give a look
Comment #9
pdureau commentedThanks for the patch @grimreaper, i have applied the changes from [ #3612556] and the results are good:
Comment #11
mogtofu33 commented