l10n_server-2.x-dev/l10n_migrate/src/Plugin/migrate/source/LocalizeFile.php
l10n_migrate/src/Plugin/migrate/source/LocalizeFile.php
<?php declare(strict_types=1); namespace Drupal\l10n_migrate\Plugin\migrate\source; use Drupal\file\Plugin\migrate\source\d7\File; use Drupal\migrate\Row; /** * File source plugin. * * @note source_module value must not be altered. * @see https://www.drupal.org/project/media_migration/issues/3353736 * * @MigrateSource( * id = "l10n_d7_file", * source_module = "file", * ) */ class LocalizeFile extends File { /** * {@inheritdoc} */ public function query() { $query = parent::query(); // Exclude .po file (synched, not migrated). $query->condition('f.filename', '%.po', 'NOT LIKE'); return $query; } /** * {@inheritdoc} */ public function prepareRow(Row $row) { $skipped = parent::prepareRow($row); $path = str_replace('public://', '', $row->getSourceProperty('uri')); $row->setSourceProperty('filepath', $path); return $skipped; } }