You are here

public function FilePlainFieldFormatter::prepareRow in Media Migration 8

File

src/Plugin/migrate/source/d7/FilePlainFieldFormatter.php, line 53

Class

FilePlainFieldFormatter
Drupal 7 media field formatter settings source based on source database.

Namespace

Drupal\media_migration\Plugin\migrate\source\d7

Code

public function prepareRow(Row $row) {
  [
    'mimes' => $mimes,
    'schemes' => $schemes,
    'source_field_name' => $source_field_name,
    'field_name' => $field_name,
  ] = $row
    ->getSource();
  if ($field_name === $source_field_name) {
    $mime = explode(static::MULTIPLE_SEPARATOR, $mimes)[0];
    $scheme = explode(static::MULTIPLE_SEPARATOR, $schemes)[0];
    if (!($dealer_plugin = $this->fileDealerManager
      ->createInstanceFromSchemeAndMime($scheme, $mime))) {
      return FALSE;
    }
    $dealer_plugin
      ->prepareMediaSourceFieldFormatterRow($row, $this
      ->getDatabase());
  }
  return parent::prepareRow($row);
}