- Issue created by @vbouchet
- @vbouchet opened merge request.
- Status changed to Needs review
over 1 year ago 2:30pm 21 March 2023 - 🇫🇷France vbouchet
Please find a MR which tries to have as little opinion as possible on how the browser should be displayed. It should not have impact on existing sites given the default image style is "Original" and description field is optional.
-
vbouchet →
committed cfec02e3 on 8.x-1.x
Issue #3349340 by vbouchet: Browser block item displayed via a theme...
-
vbouchet →
committed cfec02e3 on 8.x-1.x
- Status changed to Fixed
over 1 year ago 9:10pm 23 March 2023 Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
3 months ago 7:34am 10 September 2024 Hi,
I tried to use the template added by the commit "cfec02e3". I found that the template is a sub-template per block and is not used by default.
In a custom module:
I have added the theme with "hook_theme()"
With "hook_layout_builder_browser_alter()" have added the theme the sub elements as such:/** * Implements hook_layout_builder_browser_alter(). */ function CUSTOM_MODULE_layout_builder_browser_alter(array &$build, array $context) { foreach ($build['block_categories'] as $category_key => &$category) { if ($category_key === 'default') { foreach ($category['links'] as $block_key => &$block) { $build['block_categories'][$category_key]['links'][$block_key]['#theme'] = 'layout_builder_browser_block'; } } } }
The template is called for every block type but, unfortunately, I did not manage to get the correct variables for the template "layout-builder-browser-block.html.twig".
In the hook_theme I tried both defining variables or render element.Am I misunderstanding the intention of this template ? Did someone succeed to render the layout builder browser modal with a template ?
Thanks,