1

I created a custom block with an entity reference to a media field (field_background_image).
In the display settings I have chosen 'Thumbnail' as format and selected a custom image style 'background'.

In my _preprocess_block(&$variables) function I would like to get the selected format (thumbnail) and especially the selected image style ('background').
How can I load both these information from the $variables?

1
  • composer require drupal/devel_kint_extras && drush -y en devel_kint_extras && drush cr: This enables the Devel module, flushes cache, and now you can put ksm($variables); inside your preprocess to inspect the variables, visit the page and see what you find in there.
    – leymannx
    Nov 24 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.