protected function FieldInstancePerViewMode::initializeIterator in Drupal 9
Same name in this branch
- 9 core/modules/field/src/Plugin/migrate/source/d6/FieldInstancePerViewMode.php \Drupal\field\Plugin\migrate\source\d6\FieldInstancePerViewMode::initializeIterator()
- 9 core/modules/field/src/Plugin/migrate/source/d7/FieldInstancePerViewMode.php \Drupal\field\Plugin\migrate\source\d7\FieldInstancePerViewMode::initializeIterator()
Same name and namespace in other branches
- 8 core/modules/field/src/Plugin/migrate/source/d7/FieldInstancePerViewMode.php \Drupal\field\Plugin\migrate\source\d7\FieldInstancePerViewMode::initializeIterator()
Initializes the iterator with the source data.
Return value
\Iterator Returns an iterable object of data for this source.
Overrides FieldInstance::initializeIterator
File
- core/
modules/ field/ src/ Plugin/ migrate/ source/ d7/ FieldInstancePerViewMode.php, line 23
Class
- FieldInstancePerViewMode
- Drupal 7 field instance per view mode source class.
Namespace
Drupal\field\Plugin\migrate\source\d7Code
protected function initializeIterator() {
$instances = parent::initializeIterator();
$rows = [];
foreach ($instances
->getArrayCopy() as $instance) {
$data = unserialize($instance['data']);
foreach ($data['display'] as $view_mode => $formatter) {
$rows[] = array_merge($instance, [
'view_mode' => $view_mode,
'formatter' => $formatter,
]);
}
}
return new \ArrayIterator($rows);
}