You are here

protected function AddMediaFormBase::buildUploadUi in Media Directories 3.x

File

modules/media_directories_ui/src/Form/AddMediaFormBase.php, line 168

Class

AddMediaFormBase
Class AddMediaFormBase

Namespace

Drupal\media_directories_ui\Form

Code

protected function buildUploadUi(FormStateInterface $form_state) {

  // Get the render array for the media library. The media library state might
  // contain the 'media_library_content' when it has been opened from a
  // vertical tab. We need to remove that to make sure the render array
  // contains the vertical tabs. Besides that, we also need to force the media
  // library to create a new instance of the media add form.
  // @see \Drupal\media_library\MediaLibraryUiBuilder::buildMediaTypeAddForm()
  $state = $this
    ->getMediaLibraryState($form_state);
  $state
    ->remove('media_library_content');

  //$state->set('_media_library_form_rebuild', TRUE);
  return $this->libraryUiBuilder
    ->buildUploadUi($state);
}