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

Comments

bernardm28 created an issue. See original summary.

rasikap’s picture

Assigned: Unassigned » rasikap
rasikap’s picture

Assigned: rasikap » Unassigned

The patch that you have mentioned, works correctly and address your mentioned problem.

Thanks,
Rasika P

smustgrave’s picture

Status: Active » Postponed (maintainer needs more info)

The referenced issue has been merged, can confirm if still an issue.

bernardm28’s picture

I 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.
picture of issue.

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.

theme 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.