function UmamiHooks::preprocessImageWidget
Same name and namespace in other branches
- main core/profiles/demo_umami/themes/umami/src/Hook/UmamiHooks.php \Drupal\umami\Hook\UmamiHooks::preprocessImageWidget()
Implements hook_preprocess_HOOK() for image-widget.
@todo Revisit in https://drupal.org/node/3117430
Attributes
#[Hook('preprocess_image_widget')]
File
-
core/
profiles/ demo_umami/ themes/ umami/ src/ Hook/ UmamiHooks.php, line 180
Class
- UmamiHooks
- Hook implementations for umami.
Namespace
Drupal\umami\HookCode
public function preprocessImageWidget(&$variables) : void {
if (!empty($variables['element']['fids']['#value'])) {
$file = reset($variables['element']['#files']);
$variables['data']["file_{$file->id()}"]['filename']['#suffix'] = ' <span class="file-size">(' . ByteSizeMarkup::create($file->getSize()) . ')</span> ';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.