You are here

public function MediaDealerBase::prepareMediaSourceFieldInstanceRow in Media Migration 8

2 calls to MediaDealerBase::prepareMediaSourceFieldInstanceRow()
Fallback::prepareMediaSourceFieldInstanceRow in src/Plugin/media_migration/file/Fallback.php
Image::prepareMediaSourceFieldInstanceRow in src/Plugin/media_migration/file_entity/Image.php
2 methods override MediaDealerBase::prepareMediaSourceFieldInstanceRow()
Fallback::prepareMediaSourceFieldInstanceRow in src/Plugin/media_migration/file/Fallback.php
Image::prepareMediaSourceFieldInstanceRow in src/Plugin/media_migration/file_entity/Image.php

File

src/MediaDealerBase.php, line 186

Class

MediaDealerBase
Base implementation of media dealer plugins.

Namespace

Drupal\media_migration

Code

public function prepareMediaSourceFieldInstanceRow(Row $row, Connection $connection) : void {
  $field_instance_default = $this
    ->getMediaSourceFieldInstance();
  $settings = $field_instance_default
    ->getSettings();
  $default_extensions = $settings['file_extensions'] ?? '';
  $discovered_extensions = $row
    ->getSourceProperty('file_extensions') ?? '';
  $merged_file_extensions = implode(' ', array_filter(array_unique(array_merge(explode(' ', $default_extensions), explode(ConfigSourceBase::MULTIPLE_SEPARATOR, $discovered_extensions)))));
  $settings['file_extensions'] = $merged_file_extensions;
  $row
    ->setSourceProperty('settings', $settings);
}