<?php
function hook_preprocess_image(&$variables): void {
// Check if the image style matches the one you want to target.
if ($variables['style_name'] === 'image_style_name') {
// Add your custom class to the image.
$variables['image']['attributes']['class'][] = 'custom-class';
}
}
- Log in to post comments