Currently, this module it's missing twig template suggestions based on a browser block view mode.
It seems like only these two are provided by default.
block--entity-browser-block--[name].html.twig
block--entity-browser-block.html.twig
Adding a third one, that takes advantage of the $element['#default_view_modes'][$id] would be great.
The ending product would like like this.
block--entity-browser-block--[name]--[view-mode].html.twig
block--entity-browser-block--[name].html.twig
block--entity-browser-block.html.twig
I thought this core patch might address it but it did not
https://www.drupal.org/project/drupal/issues/3062376
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | Screenshot 2025-01-24 at 10.07.15 AM.png | 90.12 KB | bernardm28 |
| #5 | Screenshot 2025-01-24 at 9.58.58 AM.png | 99.68 KB | bernardm28 |
| #5 | Screenshot 2025-01-24 at 9.59.37 AM.png | 52.85 KB | bernardm28 |
Comments
Comment #2
rasikap commentedComment #3
rasikap commentedThe patch that you have mentioned, works correctly and address your mentioned problem.
Thanks,
Rasika P
Comment #4
smustgrave commentedThe referenced issue has been merged, can confirm if still an issue.
Comment #5
bernardm28 commentedI can confirm this is stil an issue.

Tested on 10.3.11.
One can select the view mode from the UI as seen on the pic below.
Selecting a different view mode works as expected there. One can switch view modes and see the changes visually on the page.
However, the twig template suggestion never adds the active view mode to the suggestions.
That makes it hard to theme a block in multiple ways based on its view mode. You can see the field change between them but have no access to the twig suggestion for it.