- Issue created by @Harlor
- @harlor opened merge request.
- πΊπΈUnited States mark_fullmer Tucson
Thanks for the suggested feature, and for the proposed code implementation.
I read this as a proposal to improve the UI of Drupal's "Choose Block" Controller by configuring certain categories to be collapsed and others to be uncollapsed for easier navigation by content editors.
My initial feeling is that this isn't part of the scope of the module Layout Builder Restrictions. The module *does* have the code in place to support such configuration, so it's an easy fit from an *implementation* standpoint, but controlling which categories are expanded and which are collapsed isn't intrinsically related to restricting which blocks are placeable. Put another way, we wouldn't want a site that is *simply* trying to set which categories are collapsed/uncollapsed have to install a module whose purpose is to restrict block choices.
Another reflection: is there a simpler solution that accomplishes much of the same goal? For example, what about a simple alter to the ChooseBlock controller that collapses *all* categories? Is there a strong use case for collapsing some and not others?
- π©πͺGermany Harlor Berlin
Thx for the feedback!
Yes I think there are easier approaches I guess one could also add this option in a hook_form_alter or something similar. And our use-case is that we want to collapse all categories indeed - so maybe we just don't need this level of complexity.
The idea to integrate this into layout_builder_restrictions and to work in a similar way comes form the perspective that a site-builder might want to have some blocks to be placeable easier than others and still others to be placeable not at all.
I mean to list a block in a collapsed category only sound like a restriction.
Would you allow to add the collapse all categories feature into layout_builder_restrictions?
- πΊπΈUnited States gravelpot
I agree with @mark_fullmer that there isn't a strong case to implement this interface option through Layout Builder Restrictions, since it is unrelated to the core functionality of the LBR module. While the benefit of this option would be highly relevant in the LBR context, it wouldn't only be relevant in the LBR context.
This may seem far-fetched, but I could see that if we did it here, it could even potentially conflict with other modules in the Layout Builder ecosystem if they also chose to implement that same option. Or even the Layout Builder module in Drupal core if at some point in the future they chose to implement a "collapse all categories" option on the ChooseBlock controller.
A few other possible paths forward I could see instead of adding this as an option in LBR, in addition to a site-specific alter to the ChooseBlock controller:
- Creating a new contrib module that just does this one specific thing (e.g. "Layout Builder Collapse All Categories")
- Proposing that this option be added to a more general-purpose Layout Builder ecosystem module, such as https://www.drupal.org/project/layout_builder_additions β
- Proposing that this option be added to the core Layout Builder module
- Status changed to Closed: works as designed
over 1 year ago 10:08pm 31 March 2023 - πΊπΈUnited States mark_fullmer Tucson
Thanks for the input, everyone. Reading the above, collapsing these lists really seems like it should be an option in Drupal core, since it is a display/UX behavior that is not specific to one or another contributed module for Layout Builder.
The closest issue I was able to find, where multiple people propose collapsing the list of blocks, is π The list of available blocks in Layout Builder is overwhelming to users Active .
A related issue with a similar proposal for the Block Layout UI is β¨ Make regions collapsible on the block layout administration page Active . It might be useful to think about how these should be implemented consistently.
Let's proceed by trying to see if this can be adopted in core. I will close this issue in "Layout Builder Restrictions" as "works as designed."