function AddFormBase::__construct

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

Constructs a AddFormBase object.

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\media_library\OpenerResolverInterface $opener_resolver: The opener resolver.

2 calls to AddFormBase::__construct()
FileUploadForm::__construct in core/modules/media_library/src/Form/FileUploadForm.php
Constructs a new FileUploadForm.
OEmbedForm::__construct in core/modules/media_library/src/Form/OEmbedForm.php
Constructs a new OEmbedForm.
2 methods override AddFormBase::__construct()
FileUploadForm::__construct in core/modules/media_library/src/Form/FileUploadForm.php
Constructs a new FileUploadForm.
OEmbedForm::__construct in core/modules/media_library/src/Form/OEmbedForm.php
Constructs a new OEmbedForm.

File

core/modules/media_library/src/Form/AddFormBase.php, line 75

Class

AddFormBase
Provides a base class for creating media items from within the media library.

Namespace

Drupal\media_library\Form

Code

public function __construct(EntityTypeManagerInterface $entity_type_manager, MediaLibraryUiBuilder $library_ui_builder, OpenerResolverInterface $opener_resolver = NULL) {
    $this->entityTypeManager = $entity_type_manager;
    $this->libraryUiBuilder = $library_ui_builder;
    $this->viewBuilder = $this->entityTypeManager
        ->getViewBuilder('media');
    if (!$opener_resolver) {
        @trigger_error('The media_library.opener_resolver service must be passed to AddFormBase::__construct(), it is required before Drupal 9.0.0.', E_USER_DEPRECATED);
        $opener_resolver = \Drupal::service('media_library.opener_resolver');
    }
    $this->openerResolver = $opener_resolver;
}

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