- π«π·France vbouchet
Hi @b0b,
Thanks for suggesting. I agree that the browser lacks flexibility for now, specially given that it is accessible to content editors so we should be able to tailor it based on their specific needs.
I have just pushed some code on the 1.x-dev branch to introduce an alter hook so we can programmatically alter the browser. I added an example in the layout_builder_browser.api.php with the closing off the categories:function hook_layout_builder_browser_alter(array &$build, array $context) { // Alter the placeholder of the search textfield. $build['filter']['#placeholder'] = t('Block name'); // Collapse the categories other than "Common". foreach ($build['block_categories'] as $category_key => &$category) { if ($category_key === 'common' || !isset($category['#type']) || $category['#type'] !== 'details') { continue; } $category['#open'] = FALSE; } }
I don't know if we should really have the option from the configuration form of the categories as it is opening the door to infinite requests around the personalisation of the browser via the config (I want an illustrative icon, I want to display the number of block in each category like "Category name (14)", ...).
I am not closing the issue for now to keep the discussion open but at least the original request can now easily be addressed via a small hook_alter().
I would really like to see this feature implemented. The key advantage of having the collapsible categories is if you have a lot of blocks per category, the author doesn't need to scroll a ton to see all available categories. Providing the ability to start categories as collapsed will make items more discoverable.
- πΊπΈUnited States b0b Bethlehem, PA
Thanks for the hook. That is helpful for me, but code is not an option for everyone. I would argue this isn't really asking for a new feature. It's just config for a feature that already exists, collapsing categories by clicking. :)
-
vbouchet β
committed b9898f56 on 8.x-1.x
Issue #3281138 by vbouchet: Ability to Set Categories to Expanded/...
-
vbouchet β
committed b9898f56 on 8.x-1.x
- Status changed to Fixed
over 1 year ago 11:54am 20 April 2023 - π«π·France vbouchet
Hi,
I just pushed a commit which adds an "opened" checkbox which drives the expanded/collapsed behaviour on the browser form. It is on the dev version and will be part of the next release (1.6).
Thanks,
Automatically closed - issue fixed for 2 weeks with no activity.