You are here

public function MediaSubFormManager::getMediaFormDisplay in Media Bulk Upload 8

Get the media form display for the given media type.

Parameters

\Drupal\media_bulk_upload\Entity\MediaBulkConfigInterface $mediaBulkConfig: Media bulk config entity.

\Drupal\media\MediaTypeInterface $mediaType: The media type.

Return value

\Drupal\Core\Entity\Display\EntityFormDisplayInterface The media form display to get the field widgets from.

Overrides MediaSubFormManagerInterface::getMediaFormDisplay

2 calls to MediaSubFormManager::getMediaFormDisplay()
MediaSubFormManager::buildMediaSubForm in src/MediaSubFormManager.php
MediaSubFormManager::getMediaEntityFieldComponents in src/MediaSubFormManager.php
Get the field components for the given media type.

File

src/MediaSubFormManager.php, line 186

Class

MediaSubFormManager
Class MediaSubFormManager.

Namespace

Drupal\media_bulk_upload

Code

public function getMediaFormDisplay(MediaBulkConfigInterface $mediaBulkConfig, MediaTypeInterface $mediaType) {

  /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $mediaFormDisplay */
  $mediaFormDisplay = $this->entityFormDisplayStorage
    ->load('media.' . $mediaType
    ->id() . '.' . $mediaBulkConfig
    ->get('form_mode'));
  if ($mediaFormDisplay === NULL) {
    $mediaFormDisplay = $this->entityFormDisplayStorage
      ->load('media.' . $mediaType
      ->id() . '.default');
  }
  return $mediaFormDisplay;
}