Problem/Motivation
When there is at least one empty block in a region, PageLayoutSource is not rendered by Drupal because it fails the \Drupal\Core\Render\Element::isRenderArray() check.
It happens for example with help_block which is positioned by default by UI Suite Bootstrap and UI Suite DSFR themes.
Proposed resolution
Clean empty blocks before rendering.
| Comment | File | Size | Author |
|---|
Issue fork display_builder-3612556
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 #3
pdureau commentedstarted
Comment #4
pdureau commentedDone.
The phpstan fails are probably not related to this work.
Comment #5
mogtofu33 commentedA rebase should fix ci.
Comment #6
pdureau commentedIndeed
Comment #7
mogtofu33 commentedComment #8
mogtofu33 commentedFrom User experience perspective, Page Layout seems confusing:
Then you have this 'Page Layout (from active theme)' with slot based on regions.
Obviously the user experience is confusing on creation and after. We need to facilitate adoption, not create strange unexplained behaviors.
Page Layout source was created as a way to merge existing block layout configuration so user do not have an empty page. But then we create a unexplained component with regions without real markup.
And problem is worst when using a proper theme with layout components, you basically on every new Page Layout have to remove the page layout to build your page.
What can we do to fix that and remove confusion?
Comment #9
pdureau commentedThanks for the review.
Review
The source plugin label is "Page layout (from active theme)", it may not be the best label, but I don't have better idea right now. Do you?
That's the point, this source plugin is the exact representation of the rigid, hardcoded, not configurable,
page.html.twig.Oh! Really? That's a bug, i will a have a look.
Styles: As far as I know,
page.html.twigdoesn't haveattributes, but UI styles is supposed to manage this.Visibility: Weird.
I will have a look.
UX improvements
I agree there is something to consider here. The automatic initialization with this PageLayoutSource plugin is relevant for the projects keeping Block Layout as a fallback/default. But not for the projects already using a Page Layout entity without any condition plugins set as a fallback/default.
Today, this situations is managed by:
But we can do better.
I am afraid those proposals are not fixing the fallback/default pages dichotomy because:
To improve the UX, we can make this choice more obvious by exposing it directly in the creation page (and not the edit page) of the config entity type:
Screenshot:

What do you think?
Comment #10
pdureau commentedDiscussed with Jean.
Review:
UX improvements:
Comment #11
pdureau commentedReview
Styles are using the "drilling" system of UI Styles which is sometimes working weird because the Drupal Render API is weird.
For example, with UI suite DaisyUI, it drills until the navbar slots.
So, to have a consistent behavior, I have wrapped the renderable in a
html_tagwhich will host the styles and other dynamic attributes.For visibility, I don't see surprising behaviour in Preview and final result. But I see weird stuff in Builder/Canvas: the renderable is not rendered anymore, that's normal, but the children are. Not being familiar with Visibility panel, i don't know if it is OK, but it doesn't seem something introduced by the current work which is fixing already a lot.
UX improvments
The create form page will be discussed after beta6.
Comment #12
mogtofu33 commentedTest KO ❌
return $page;Comment #13
pdureau commentedOh shout! you are right.
The current state of the MR is not working with every theme:
I will do a change, test with all themes I have available, so i will send to review only when i am 100% sure.
Comment #14
pdureau commentedDiscussed with @mogtofu33 at weekly meeting.
We will update the entity create form page, but instead of proposing:
We will propose:
Comment #15
mogtofu33 commentedProposition of naming for "Page layout (active theme)" > "Theme page shell (_theme_name_)"
Proposition of select options wording with help text:
After default is created we keep only option minimal and blank plus extra help line:
Comment #16
pdureau commentedHi Jean, your help and wording proposals are welcomed 🤗
I would just advise to not introduce the word "shell" which sounds technical and is not used anywhere in Display Builder, UI Suite or Drupal.
Comment #17
mogtofu33 commentedLet's have this without the wrapper in the code to have a follow up issue, in every case it is already better than last beta.
Comment #20
pdureau commentedSure. I will create the follow up issue.
However, I am afraid the merged commit is not working properly (especially for
BuilderPanel), because this part has been removed:But not the related
contentkey here:So, we also need to fix this ASAP.
Comment #21
pdureau commentedFolllow-up: #3614776: Make PageLayoutSource compatible with attributes
Comment #22
mogtofu33 commentedI already created a child issue before #3614706: PageLayout styles and visibility.
And tested with UI Suite Bootstrap and both array works. Will update your issue.
Comment #23
mogtofu33 commented