I want to edit the file upload description label and the help sentence underneath it:
I tried the below code:
function mymodule_field_widget_form_alter(&$element, FormStateInterface &$form_state, $context) {
if (isset($element['#field_name'] == 'field_file_description') {
// Add process callback to change field description.
$element['#process'][] = 'chg_desc';
}
}
}
function chg_desc($element, FormStateInterface $form_state, $form) {
$element['#description'] = t('Trying to edit desc help');
return $element;
}
It does not have any impact on the field label and help text. How can they be changed?