function MediaLibraryHooks::mediaSourceInfoAlter

Implements hook_media_source_info_alter().

File

core/modules/media_library/src/Hook/MediaLibraryHooks.php, line 79

Class

MediaLibraryHooks
Hook implementations for media_library.

Namespace

Drupal\media_library\Hook

Code

public function mediaSourceInfoAlter(array &$sources) : void {
    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.