function stable_preprocess_image_widget in Drupal 8
Same name and namespace in other branches
- 9 core/themes/stable/stable.theme \stable_preprocess_image_widget()
 
Implements hook_preprocess_image_widget().
File
- core/
themes/ stable/ stable.theme, line 73  - Functions to support theming in the Stable theme.
 
Code
function stable_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> ';
  }
}