function file_entity_preprocess_image_formatter in File Entity (fieldable files) 8.2
Implements hook_preprocess_image_formatter().
File
- ./
file_entity.module, line 504 - Extends Drupal file entities to be fieldable and viewable.
Code
function file_entity_preprocess_image_formatter(&$variables) {
if (empty($variables['image']['#width']) || empty($variables['image']['#height'])) {
foreach ([
'width',
'height',
] as $key) {
$variables['image']["#{$key}"] = $variables['item']->entity
->getMetadata($key);
}
}
}