public function MediaEntityGenerator::prepareRow in Migrate File Entities to Media Entities 8
Adds additional data to the row.
Parameters
\Drupal\migrate\Row $row: The row object.
Return value
bool FALSE if this row needs to be skipped.
Overrides SourcePluginBase::prepareRow
File
- src/
Plugin/ migrate/ source/ MediaEntityGenerator.php, line 107
Class
- MediaEntityGenerator
- Returns bare-bones information about every available file entity.
Namespace
Drupal\migrate_file_to_media\Plugin\migrate\sourceCode
public function prepareRow(Row $row) {
// Set source file.
if (!empty($row
->getSource()['target_id'])) {
/** @var \Drupal\file\Entity\File $file */
$file = File::load($row
->getSource()['target_id']);
if ($file) {
$row
->setSourceProperty('file_path', $file
->getFileUri());
$row
->setSourceProperty('file_name', $file
->getFilename());
$row
->setSourceProperty('uid', $file
->getOwnerId());
}
}
}