function media_library_media_source_info_alter

Same name and namespace in other branches
  1. 9 core/modules/media_library/media_library.module \media_library_media_source_info_alter()
  2. 8.9.x core/modules/media_library/media_library.module \media_library_media_source_info_alter()
  3. 10 core/modules/media_library/media_library.module \media_library_media_source_info_alter()

Implements hook_media_source_info_alter().

File

core/modules/media_library/media_library.module, line 82

Code

function media_library_media_source_info_alter(array &$sources) {
    if (empty($sources['audio_file']['forms']['media_library_add'])) {
        $sources['audio_file']['forms']['media_library_add'] = FileUploadForm::class;
    }
    if (empty($sources['file']['forms']['media_library_add'])) {
        $sources['file']['forms']['media_library_add'] = FileUploadForm::class;
    }
    if (empty($sources['image']['forms']['media_library_add'])) {
        $sources['image']['forms']['media_library_add'] = FileUploadForm::class;
    }
    if (empty($sources['video_file']['forms']['media_library_add'])) {
        $sources['video_file']['forms']['media_library_add'] = FileUploadForm::class;
    }
    if (empty($sources['oembed:video']['forms']['media_library_add'])) {
        $sources['oembed:video']['forms']['media_library_add'] = OEmbedForm::class;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.