For example, I want to override image template (image.html.twig) to change how it outputs images from
<img{{ attributes }} />
to
<div class="image" style="background-image: url('{{ attributes.src }}');"></div>
But I require to override only those images, that are rendered inside specific block type (called "bundle" in Drupal terms) b_partner_images
.
There is a hook_theme_suggestions_alter(array &$suggestions, array $variables, $hook) hook, that allows to create suggestions based on some conditions, but the problem is that $variables
does not contain anything more than image tag attributes - no objects or identifiers, so I see no way to create condition based on some identifiers or block (bundle) name.
How to create file name suggestion for system templates (such as image) to override image output based on block type or any other identifier?