hook_form_alter および after_build 関数を使用して行うこともできます
// hook_form_alter implementation
function yourmodule_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
case 'your_form_id':
$form['your_file_field'][LANGUAGE_NONE]['#after_build'][] = 'yourmodule_hide_remove_button';
break;
}
}
// after_build function
function yourmodule_hide_remove_button($element, &$form_state) {
// if multiple files are allowed in the field, then there may be more than one remove button.
// and we have to hide all remove buttons, not just the one of the first file of the field
//
// Array
// (
// [0] => 0
// [1] => 1
// [2] => #after_build
// [3] => #field_name
// [4] => #language
// [5] => ...
// )
//
// the exemple above means we have 2 remove buttons to hide (2 files have been uploaded)
foreach ($element as $key => $value){
if (is_numeric($key)){
unset($element[$key]['remove_button']);
} else break;
}
return $element;
}