I'm trying to replace the file-link.html.twig file to show the size next to the file link (also the MIME file type, but I can understand it once I figured out how to display size), but up to here I have failed spectacularly. I guess it must be super simple and I'm missing something obvious.
By using kint ($ variables) in the function main_motor_file_file_file (& $ variables), I see the size of the file:
$ args array (1) painting (15 & # 39; line & # 39; => Drupal file Entity File (27) "content" tab: protected values -> table (13) & # 39; file size & # 39; => array (1) & # 39; x-default & # 39; => string (7) "2245389"
But I do not understand how to turn this into a variable that I can use in my twig file.
I've tried to follow this: How can I replace the template_preprocess_file_link function?
But then I could not understand what was supposed to be the variable to use in twig … so its "code" just seems to be the same as it is here: https://api.drupal.org/api/drupal/ core% 21modules% 21file% 21file.module / function / template_preprocess_file_link / 8.6.x