You are here

function umami_preprocess_image_widget in Drupal 9

Implements hook_preprocess_image_widget().

@todo Revisit in https://drupal.org/node/3117430

File

core/profiles/demo_umami/themes/umami/umami.theme, line 149
Functions to support theming in the Umami theme.

Code

function umami_preprocess_image_widget(&$variables) {
  if (!empty($variables['element']['fids']['#value'])) {
    $file = reset($variables['element']['#files']);
    $variables['data']["file_{$file->id()}"]['filename']['#suffix'] = ' <span class="file-size">(' . format_size($file
      ->getSize()) . ')</span> ';
  }
}