You are here

public function MediaTypePersistenceManager::getFileSettings in Gutenberg 8.2

Returns the media source file settings.

Parameters

string $media_type: Media type machine name.

Return value

array List of media file settings.

Overrides MediaTypePersistenceManagerInterface::getFileSettings

File

src/Persistence/MediaTypePersistenceManager.php, line 78

Class

MediaTypePersistenceManager
Provides management for all media types.

Namespace

Drupal\gutenberg\Persistence

Code

public function getFileSettings(string $media_type) {

  /** @var \Drupal\media\MediaTypeInterface $media_type_entity */
  $media_type_entity = $this->entityTypeManager
    ->getStorage('media_type')
    ->load($media_type);
  $source = $media_type_entity
    ->getSource();
  $source_field_definition = $source
    ->getSourceFieldDefinition($media_type_entity);
  if ($source_field_definition) {
    return $source_field_definition
      ->getSettings();
  }
  return [];
}