- 🇺🇸United States dcam
If you need a workaround for this issue, then you can put this in your custom theme:
/** * Implements hook_element_info_alter(). */ function MY_THEME_element_info_alter(array &$info) { $info['managed_file']['#process'][] = '_MY_THEME_process_managed_file_element'; } /** * Processes managed file elements. * * A required attribute isn't set on the child upload element and it can't be * done in a preprocess function. It must be set before the element is * rendered. * * @param array element * A managed file form element. * * @return array * The processed managed file element. * * @see https://www.drupal.org/project/drupal/issues/2852874 */ function _MY_THEME_process_managed_file_element(array $element) { if (isset($element['#required']) && $element['#required']) { $element['upload']['#required'] = TRUE; } return $element; }
I'll see about fixing it properly in Drupal Core another time.