protected function FilePlainFieldFormatter::initializeIterator in Media Migration 8
Overrides FilePlainConfigSourceBase::initializeIterator
File
- src/
Plugin/ migrate/ source/ d7/ FilePlainFieldFormatter.php, line 20
Class
- FilePlainFieldFormatter
- Drupal 7 media field formatter settings source based on source database.
Namespace
Drupal\media_migration\Plugin\migrate\source\d7Code
protected function initializeIterator() {
// Media Migration wants to hide "created", "name", "thumbnail" and "uid"
// base fields for the default view mode.
// @see \Drupal\media\Entity\Media
$iterator = parent::initializeIterator();
$rows = [];
foreach ($iterator
->getArrayCopy() as $item) {
[
'source_field_name' => $source_field_name,
] = $item;
$field_names = [
$source_field_name => FALSE,
'created' => TRUE,
'name' => TRUE,
'thumbnail' => TRUE,
'uid' => TRUE,
];
foreach ($field_names as $field_name => $hidden) {
$rows[] = [
'field_name' => $field_name,
'hidden' => $hidden,
] + $item;
}
}
return new \ArrayIterator($rows);
}