diff --git a/core/modules/media/media.module b/core/modules/media/media.module index eeb2ac168a..857b79cfb7 100644 --- a/core/modules/media/media.module +++ b/core/modules/media/media.module @@ -114,3 +114,25 @@ function template_preprocess_media(array &$variables) { $variables['content'][$key] = $variables['elements'][$key]; } } + +/** + * Implements hook_form_FORM_ID_alter(). + */ +function media_form_field_ui_field_storage_add_form_alter(array &$form) { + $reference = (string) t('Reference'); + $general = (string) t('General'); + + // Move the "file" option to the "General" optgroup. + if (isset($form['add']['new_storage_type']['#options'][$reference]['image'])) { + $image = $form['add']['new_storage_type']['#options'][$reference]['image']; + $form['add']['new_storage_type']['#options'][$general]['image'] = $image; + unset($form['add']['new_storage_type']['#options'][$reference]['image']); + } + + // Move the "file" option to the "General" optgroup. + if (isset($form['add']['new_storage_type']['#options'][$reference]['file'])) { + $file = $form['add']['new_storage_type']['#options'][$reference]['file']; + unset($form['add']['new_storage_type']['#options'][$reference]['file']); + $form['add']['new_storage_type']['#options'][$general]['file'] = $file; + } +}