function FileUploadForm::__construct

Same name in other branches
  1. 9 core/modules/media_library/src/Form/FileUploadForm.php \Drupal\media_library\Form\FileUploadForm::__construct()
  2. 10 core/modules/media_library/src/Form/FileUploadForm.php \Drupal\media_library\Form\FileUploadForm::__construct()
  3. 11.x core/modules/media_library/src/Form/FileUploadForm.php \Drupal\media_library\Form\FileUploadForm::__construct()

Constructs a new FileUploadForm.

Parameters

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

\Drupal\media_library\MediaLibraryUiBuilder $library_ui_builder: The media library UI builder.

\Drupal\Core\Render\ElementInfoManagerInterface $element_info: The element info manager.

\Drupal\Core\Render\RendererInterface $renderer: The renderer service.

\Drupal\Core\File\FileSystemInterface $file_system: The file system service.

\Drupal\media_library\OpenerResolverInterface $opener_resolver: The opener resolver.

\Drupal\file\FileUsage\FileUsageInterface $file_usage: The file usage service.

Overrides AddFormBase::__construct

File

core/modules/media_library/src/Form/FileUploadForm.php, line 80

Class

FileUploadForm
Creates a form to create media entities from uploaded files.

Namespace

Drupal\media_library\Form

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, MediaLibraryUiBuilder $library_ui_builder, ElementInfoManagerInterface $element_info, RendererInterface $renderer, FileSystemInterface $file_system, OpenerResolverInterface $opener_resolver = NULL, FileUsageInterface $file_usage = NULL) {
    parent::__construct($entity_type_manager, $library_ui_builder, $opener_resolver);
    $this->elementInfo = $element_info;
    $this->renderer = $renderer;
    $this->fileSystem = $file_system;
    if (!$file_usage) {
        @trigger_error('Calling FileUploadForm::__construct() without the `file.usage` service is deprecated in drupal:8.8.0 and is removed in drupal:9.0.0. Pass the `file.usage` service to the constructor. See https://www.drupal.org/node/3075165', E_USER_DEPRECATED);
        $file_usage = \Drupal::service('file.usage');
    }
    $this->fileUsage = $file_usage;
}

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