You are here

function animated_gif_preprocess_responsive_image_formatter in Animated GIF 8

Implements template_preprocess_responsive_image_formatter().

File

./animated_gif.module, line 31

Code

function animated_gif_preprocess_responsive_image_formatter(&$variables) {
  $image = $variables['item'];
  $imageValues = $image
    ->getValue();
  $file = File::load($imageValues['target_id']);
  if ($file && $file
    ->getMimeType() === 'image/gif' && _animated_gif_is_animated($file
    ->getFileUri())) {
    $variables['responsive_image']['#theme'] = 'image';
    unset($variables['image']['#responsive_image_style_id']);
    unset($variables['image_style']);
  }
}