Using Widget Form Alter

Requirement: Modify the file description field to change the label and help text for a specific content type. This feature is provided by file field and a simple form_alter was not useful to modify the description label of the file field.

<?php
/**
* hook_field_widget_form_alter()
*/
function ji_custom_field_widget_form_alter(&$element, &$form_state, $context) {
  if(isset(
$element['#field_name']) && isset($context['form']['#node_edit_form'])
    &&
$context['form']['#node_edit_form'] == TRUE) {
   
$field_name = $element['#field_name'];
    switch (
$field_name) {
      case
'field_document_file':
        foreach (
element_children($element) as $key => $child) {
         
// Add the new process function to the element
         
$element[$key]['#process'][] = 'ji_custom_file_field_widget_process';
        }
}

function
ji_custom_file_field_widget_process($element, &$form_state, $form) {
  if(isset(
$element['description']['#title'])){
   
$element['description']['#title'] = 'Version';
   
$element['description']['#description'] = 'If required, please enter the version number of the file';
  }
  return
$element;
}
?>