You are here

function file_entity_preprocess_responsive_image_formatter in File Entity (fieldable files) 8.2

Implements hook_preprocess_responsive_image_formatter().

File

./file_entity.module, line 493
Extends Drupal file entities to be fieldable and viewable.

Code

function file_entity_preprocess_responsive_image_formatter(&$variables) {
  if (empty($variables['responsive_image']['#width']) || empty($variables['responsive_image']['#height'])) {
    foreach ([
      'width',
      'height',
    ] as $key) {
      $variables['responsive_image']["#{$key}"] = $variables['item']->entity
        ->getMetadata($key);
    }
  }
}