I want to theme all the file upload fields on my site but I don't know how to name the template file.
I want to alter the form-element.html.twig file but as I have multiple file fields I don't think that the best way is to create theme files for each field. So I was thinking to create a theme based on the field type. Is that possible?
I used the hook_theme_suggestions_input_alter.
function MY_MODULE_theme_suggestions_input_alter(&$suggestions, array $variables) {
$element = $variables['element'];
if (strcmp($element['#type'],'file') == 0) {
$suggestions[] = 'form-element--file';
}
}
After clearing the caches seems that doesn't work.
Is this the correct way or is there any other way?